All Projects → LucianU → django-startproject

LucianU / django-startproject

Licence: other
No longer maintained. Instead, try https://github.com/LucianU/bud, which uses Vagrant + Ansible to automate a lot more things.

Programming Languages

python
139335 projects - #7 most used programming language
Nginx
273 projects
HTML
75241 projects

DEPRECATED in favor of https://github.com/LucianU/bud.

Quickstart

  1. Create your virtualenv with the same name as the project, activate it and install Django.

  2. Create your project by running:

    django-admin.py startproject -e py -e conf -e ini -e nginx --template=https://github.com/LucianU/django-startproject/zipball/master <project>
    

replacing <project> with the name of your project.

  1. Install the requirements in the virtualenv:

    cd /path/to/project
    pip install -r requirements/common.pip
    
  2. Create a database and put the credentials in your settings/local.py file.

  3. Sync the database:

    python manage.py syncdb
    
  4. Run the server and visit the site in the browser. You should see the welcome message from Django:

    python manage.py runserver 127.0.0.1:8000
    

Finally, you can look at the different files in the confs directory and its subdirectories and adjust the values as you wish. Replace the placeholders with your wanted values. Also, go into the fabfile/targets.py file and adjust the env vars as you see fit.

Overview

This project template is based on a certain stack of applications. These are:

- pip as package manager
- virtualenv and virtualenvwrapper for dependency containment
- postgresql as a database
- nginx and uwsgi as a proxy and application server respectively
- supervisor for process management
- memcached for caching
- fabric + git for deployment

The fabfile package contains several modules that provide tasks for deployment, project setup and interaction with the applications used.

The most basic idea is that when you run a task you have to specify the deployment enviroment on which you want the task to run. To do that you use a task specific to that environment, one of here, stag and prod. here corresponds to your local machine, stag to the staging environment and prod to the production environment. For example, to setup the project on your machine, you run:

fab here first_deploy

This task clones the project in the current directory, creates a virtualenv, installs all the requirements, synchronizes the database and collects the static files, so make sure you've installed the big dependencies, setup the database and populated the local.py settings file with the credentials.

After that, every time you want to deploy changes to production, make sure you've pushed them to the central repo and then run:

fab prod deploy

This task updates the code and checks out the right branch, makes sure all requirements are installed, runs syncdb and collectstatic and then restarts supervisord.

Contribute

If you think this document could be improved in any way, please open an issue on GitHub. The same is true for the project itself.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].