This project structure is in active development and continuously evolves. It uses the magnificent batteries-included super-fast template Jinja2 and the wrapper around it (to make our lives easier) django-jinja. It uses the fabulous command-like tool Fabric and the awesome IT automation tool Ansible that together work like a charm.
- Because Fabric works under Python 2, I always have a virtualenv in my PC with python 2 and fabric installed under it.
- Ansible is globally installed in my PC, so no worries
So:
- Ensure that Ansible is installed globally on your machine.
sudo pip install ansible
- Create a virtual environment (using pipenv or virtualenvwrapper) with python 2 as the default interpreter. I would name this env it deploy.
- Install Fabric:
pip install fabric
- This env should be activated, each time a fabric command is executed.
- Create another virtualenv that will hold your project-specific dependencies (like django, psycopg2 etc).
- Install django under this env:
pip install django
- Run:
django-admin startproject --template https://github.com/manikos/django_skeleton_vps_react/archive/master.zip --extension py,json,js --name constants.yml your_project_name
- Install requirements (inside the virtualenv, of course):
pip install -r requirements/base.txt
After project created in your desired (local) directory, you can delete the README.md file from your directory.
The produced project structure looks like this:
proj ├── gitignore ├── logs │ ├── db.log │ ├── dev.log │ ├── my_apps.log │ └── production.log ├── manage.py ├── media_root │ └── README.md ├── myutils │ ├── admin.py │ ├── apps.py │ ├── context_processors.py │ ├── __init__.py │ ├── locale │ │ └── el │ │ └── LC_MESSAGES │ │ └── README.md │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── templatetags │ │ ├── __init__.py │ │ ├── myutils_filters.py │ │ └── myutils_tags.py │ ├── tests.py │ └── views.py ├── proj │ ├── automation │ │ ├── dev │ │ │ ├── fabfile.py │ │ └── prod │ │ ├── ansible.cfg │ │ ├── deploy_root.yml │ │ ├── deploy_user.yml │ │ ├── fabfile.py │ │ ├── group_vars │ │ │ └── constants.yml │ │ ├── hosts │ │ └── roles │ │ ├── birth │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ └── tasks │ │ │ ├── after_startup.yml │ │ │ ├── main.yml │ │ │ └── on_startup.yml │ │ └── setup │ │ ├── handlers │ │ │ └── main.yml │ │ ├── tasks │ │ │ ├── application.yml │ │ │ ├── bitbucket.yml │ │ │ ├── database.yml │ │ │ ├── gateway_server.yml │ │ │ ├── main.yml │ │ │ ├── system.yml │ │ │ ├── virtualenv.yml │ │ │ └── web_server.yml │ │ └── templates │ │ ├── bash_aliases.j2 │ │ ├── vimrc.j2 │ │ ├── jail.local.j2 │ │ ├── nginx.conf.j2 │ │ ├── nginx_sites_avail.j2 │ │ ├── pyenvrc.j2 │ │ ├── uwsgi.ini.j2 │ │ └── uwsgi.service.j2 │ ├── __init__.py │ ├── locale │ │ └── el │ │ └── LC_MESSAGES │ ├── settings │ │ ├── base.py │ │ ├── __init__.py │ │ ├── local.py │ │ ├── production.py │ │ └── secret.json │ ├── urls.py │ └── wsgi.py ├── README.md ├── requirements.txt ├── robots.txt ├── static/ │ ├── css/ │ ├── fonts/ │ ├── img/ │ ├── js/ ├── static_root │ └── README.md └── templates └── base └── base.html
- Python 3.6.4
- Fabric (for running development-related and production-related commands)
- Ansible 2.4 (for automation of deployment)
The next thing I like to build is a docker-ready fully functional website, batteries included.