V
V
Vladislav Vlastovskiy2014-04-23 10:59:52
Django
Vladislav Vlastovskiy, 2014-04-23 10:59:52

What is the optimal structure and algorithm for deploying a Python application?

The tasks that I set to determine the directory structure and the algorithm for deploying a new version of the application using the example of a django-based application:

  • quick rollback to the previous version;
  • everything related to the project should be in one place (configs, temporary files, logs);
  • support for shared folders for any application version (media, static);
  • each version must have its own virtual environment, for example, they used django 1.3, in the new version it is already 1.7, part of the function could be removed, the new code also uses the capabilities of the new version, so you can neither update the environment with the current code, nor update the code to the old environment .

example.com (~)
├── /conf
│   ├── nginx.conf
│   ├── uwsgi.conf
├── /logs
│   ├── exmaple.com_access.log
│   ├── example.com_error.log
│   ├── uwsgi.log
├── /tmp
│   ├── reload-uwsgi (touch file)
│   ├── uwsgi.pid
├── /htdocs (www)
│   ├── /media --> ~/shared/media
│   ├── /static --> ~/shared/static
├── /releases
│   ├── /20140312195611
│   │   ├── /venv
│   │   │   ├── /bin
│   │   │   │   ├── python
│   │   │   │   ├── pip
│   │   ├── /<repository_root> - VCS (git,...)
│   │   │   ├── /docs
│   │   │   ├── /<project_name> - Django project
│   │   │   │   ├── /<project_name>
│   │   │   │   │   ├── settings.py
│   │   │   │   │   ├── urls.py
│   │   │   │   ├── manage.py
├── /current --> ~/releases/20140312195611
├── /shared
│   ├── /media
│   ├── /static

How healthy is this structure? Is there something that I did not take into account, some "pitfalls"?
What structure do you have on a productive server?
PS this structure is very similar to the result of capistrano.
04/24/2016 13:12 Added a folder for logs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DAlex, 2014-12-11
@DAlex

Why create deep directory trees when you can use a version control system (like Git)? As the product develops, each new version can develop in a separate branch. If you want to roll back to a certain version, you just take the code from the required branch... Playing with catalogs will not lead to anything good, especially if several people are working on the project

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question