Starting Django Projects
Florian Demmer - www.floriandemmer.com
django-admin startproject
Django Friends Meetup, 2016-01-25
What is it?
Creates a Django project directory structure for the given project name in the current directory or the given destination.
How?
mkvirtualenv foo pip install django django-admin startproject foo
in Django v1.9
python -m django startproject foo
... and then
make settings a package
split into base+dev+prod
move apps to subfolder
create gitignore, version.py, README
...
repetitive work!
DRY
python -m django startproject --template=https://github.com/fdemmer/django_project_template/archive/master.zip foo
Features
- works with zip file or directory as template
- also remote: http(s) or ftp
- use variables in file names and file content
- project_name
- project_directory
- secret_key
- docs_version
Want more?
- cookie cutter:
https://cookiecutter.readthedocs.org/en/latest/
- Django template:
https://github.com/pydanny/cookiecutter-django
Related: requirements.txt
# pip install pip-tools # vi requirements.in wagtail==1.3.1 <esc>:wq # pip-compile requirements.in # cat requirements.txt wagtail==1.3.1 django-modelcluster==1.1 # via wagtail django-taggit==0.18.0 # via wagtail ...
All the things
Django docs:
https://docs.djangoproject.com/en/1.9/ref/django-admin/my template: https://github.com/fdemmer/django_project_template
cookie cutter: https://github.com/pydanny/cookiecutter-django
me: http://www.floriandemmer.com
my twitter: @fdemmer
slides: https://slides.com/fdemmer
Friends Meetup, 2016-01-25
By Florian Demmer
Friends Meetup, 2016-01-25
- 1,548