_/_/_/ _/ _/ _/_/
_/ _/ _/_/ _/_/_/ _/_/_/ _/_/ _/ _/ _/ _/
_/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/_/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/
A Fabric deployment strategy for Python web applications.
Denim has been primarily developed to support Django web applications, deployed to Debian GNU/Linux (and derivative) platforms. With tools to support nginx, supervisor, virtual env, gunicorn, pip etc.
Designed to provide a rich tool-set built on top of and working with the existing functionality provided by Fabric. Get up and running quickly with the default deployment strategy.
The default strategy describes a project layout and deployment structure for Django applications that lets you deploy straight away
The strategy is designed to take a freshly deployed server and provision, deploy and activate your application, using best practices.
By default your application will run as the user webapps with a /bin/false
shell and write access to limited parts of the filesystem. All code is owned by root.
Certain key variables are required to be set in the Fabric env
dictionary, these should be setup in your fabfile:
- project_name
The name of your project, this does not need to be Python compatible (ie you can use a dash '-').
- package_name
The name of the python package being deployed, this name is the name of your applications package folder (i.e. the django project name).
- deploy_env
The name of the environment you are deploying your application into, this is used to determine which configuration should be used. For example production, stage, uat.
These key variables will be used throughout this document.
/opt/webapps/project_name | Deploy path |
app |
Application package deploy path |
|
The current package version1 |
|
The revision and application package |
bin |
Binary folder2 |
include |
Include folder3 |
lib |
Lib folder4 |
public |
Public web root for web server |
|
Application content or uploaded data5 |
|
Static application content |
var |
Application variable data6 |
|
WSGI socket |
/var/log/webapps/project_name/package_name | Project log path7 |
app | Application source root |
package_name |
Application package8 |
|
Deployment settings folder |
|
Environment configuration9 |
requirements.txt |
PIP requirements file |
conf | Configuration |
init.d |
Startup scripts for init.d |
nginx |
Nginx configuration |
|
Environment configuration10 |
fabfile.py | Project fabric definition file |
Symlink to the current revision.↩
Virtualenv created folders.↩
Virtualenv created folders.↩
Virtualenv created folders.↩
Writable by application user.↩
Writable by application user.↩
Writable by application user.↩
This structure is based on Django 1.4.↩
Used to apply specific configuration based on deployment environment.↩
Used to apply specific configuration based on deployment environment.↩