Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp
Commits
c54aceaf
Commit
c54aceaf
authored
5 years ago
by
plup
Browse files
Options
Downloads
Patches
Plain Diff
feature: tied django startproject with custom template
parent
8ca6123c
No related branches found
Branches containing commit
Tags
v2.3.19
Tags containing commit
1 merge request
!158
Load djangoldp conguration from YAML file
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
djangoldp/cli.py
+47
-0
47 additions, 0 deletions
djangoldp/cli.py
docs/using_client.md
+2
-2
2 additions, 2 deletions
docs/using_client.md
setup.cfg
+6
-0
6 additions, 0 deletions
setup.cfg
with
55 additions
and
2 deletions
djangoldp/cli.py
0 → 100644
+
47
−
0
View file @
c54aceaf
import
click
from
pkg_resources
import
resource_filename
from
pathlib
import
Path
from
django.core
import
management
from
django.core.management.base
import
CommandError
from
.
import
__version__
# click entrypoint
@click.group
()
@click.version_option
(
__version__
)
def
main
():
"""
DjangoLDP
"""
@main.command
()
@click.argument
(
'
name
'
,
nargs
=
1
)
@click.option
(
'
--production
'
,
is_flag
=
True
,
default
=
False
,
help
=
'
Use a production template
'
)
def
start
(
name
,
production
):
"""
Start a DjangoLDP project.
"""
try
:
# set a directory from project name in pwd
directory
=
Path
.
cwd
()
/
name
# create dir
directory
.
mkdir
(
parents
=
False
,
exist_ok
=
False
)
# wrap the default django-admin startproject command
management
.
call_command
(
'
startproject
'
,
name
,
directory
,
template
=
get_template
(
production
))
except
FileExistsError
:
click
.
echo
(
f
'
Error: the folder
{
directory
}
already exists
'
)
except
CommandError
as
e
:
click
.
echo
(
f
'
Error:
{
e
}
'
)
def
get_template
(
production
):
"""
Return the path of project template from package resouces.
"""
if
production
:
return
resource_filename
(
__name__
,
'
templates/production
'
)
return
resource_filename
(
__name__
,
'
templates/development
'
)
This diff is collapsed.
Click to expand it.
docs/using_client.md
+
2
−
2
View file @
c54aceaf
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
```
```
# docker run --rm -v $PWD:/code -w /code -it python:3.6 bash
# docker run --rm -v $PWD:/code -w /code -it python:3.6 bash
# pip install .
# pip install .
# django-admin startproject sibserver /tmp/ --template /code/sib/templates/development/
# cd /tmp/
# cd /tmp/
# djangoldp start myproject
```
```
Then c
onfigure
`djangoldp_account`
in
`packages.yml`
and install it:
BUGFIX: C
onfigure
`djangoldp_account`
in
`packages.yml`
and install it:
```
```
# pip install djangoldp_account
# pip install djangoldp_account
```
```
...
...
This diff is collapsed.
Click to expand it.
setup.cfg
+
6
−
0
View file @
c54aceaf
...
@@ -24,6 +24,12 @@ install_requires =
...
@@ -24,6 +24,12 @@ install_requires =
django_rest_framework
=
=0.1.0
django_rest_framework
=
=0.1.0
requests
=
=2.23.0
requests
=
=2.23.0
pyyaml
=
=5.3.1
pyyaml
=
=5.3.1
pyyaml
=
= 5.3.1
click
=
= 7.1.1
[options.entry_points]
console_scripts
=
djangoldp
=
djangoldp.cli:main
[options.extras_require]
[options.extras_require]
dev
=
dev
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment