Skip to main content

Automaticly manages virtualenv for django project

Project description

Installation

You have to consider where to place this package. Simplest way is to do:

pip install django-env

or using archive

tar xf django-env*
cd django-env*
python setup.py install

Configuration

settings.py

First, you have some options in settings.py:

DJANGO_ENV = ‘py_env’

name of the environment. If this is a name, environment will be placed in project directory. If it is an absolute path, it will be used instead.

DJANGO_ENV_AUTOUPDATE = False

it tells wheter after creating (env_create) environment it should automatically install packages (run env_update)

DJANGO_ENV_REQUIREMENTS = ‘requirements.pip’

name of file with requirements of environments. django-env will be searching it in project directory.

And of course add env to INSTALLED_APPS

INSTALLED_APPS += ('env', )

project setup

How to activate the environment? Example:

from env import setup
setup(autocreate=False)  # default

I suggest to place it in manage.py at the bottom:

import settings

if __name__ == "__main__":
    execute_manager(settings)
    from env import setup
    setup()

of if you want to auto-create environment:

import settings

if __name__ == "__main__":
    execute_manager(settings)
    from env import setup
    setup(autocreate=True)

Usage

Target of this project is automating in creating project environment.

This app gives you some additional manage.py commands:

env_create [–force]

create environment (and optionally do env_update - it depends on DJANGO_ENV_AUTOUPDATE variable in settings.py)

env_update [-U|–upgrade]

install packages from DJANGO_ENV_REQUIREMENTS file to current environment via pip install -r, or if you provide –upgrade it runs pip install -U -r.

env_remove

simply deletes environments directory.

TODO

  • py_env/last_update - show last update date - monitoring feature

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-env-0.1.tar.gz (11.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page