A django-specific enhancement to virtualenvwrapper's mkvirtualenv function to setup the settings and pythonpath variables, auto-install requirements, set the project path, and install git modules if possible.
Project description
Performs the command mkvirtualenv ENV_NAME, but also:
sets the directory to jump to when the virtualenv is activated
sets the PYTHONPATH and DJANGO_SETTINGS_MODULE in the postactivate hook
auto-installs dependencies if there is a requirements.txt file
auto-inits git submodules if there are any
This is intended to save environment setup busywork after pulling down a django project from github.
This does not run django-admin.py startproject, instead it is for configuring the environment for an existing django project. If you are looking for a way to create an empty django project with virtualenvwrapper, check out the [virtualenvwrapper.django template plugin for virtualenvwrapper](http://www.doughellmann.com/projects/virtualenvwrapper.django/).
Usage
mkdjangovirtualenv [–settings DJANGO_SETTINGS_MODULE] ENV_NAME [PROJECT_DIRECTORY]
Options
- --settings DJANGO_SETTINGS_MODULE
Provide a python import path for the settings file. Defaults to project.settings
ENV_NAME
The name for the virtualenv
PROJECT_DIRECTORY
Provide a path to the root of the project. May be a relative path, defaults the current working directory.
Installation
sudo pip install mkdjangovirtualenv
This will pull down the latest copy of the scripts from PYPI and place them in your path. You can then run the mkdjangovirtualenv script directly.
For the best expierence, source the mkdjangovirtualenv.sh file just after your source virtualenvwrapper.sh in your startup scripts. For example, my ~/.bash_profile has:
export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh source /usr/local/bin/mkdjangovirtualenv.sh
The benefit of this approach is that it makes it a bash function instead of a script, so it will actually activate the new virualenv for you, whereas the script would have needed to be run with source to have the same affect.
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
File details
Details for the file mkdjangovirtualenv-0.0.7.tar.gz
.
File metadata
- Download URL: mkdjangovirtualenv-0.0.7.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d2ac12971f17c543431d6866ac16546f89922d223ac420554777806cfe0955f |
|
MD5 | 58702956042108a5813184fb34653ca0 |
|
BLAKE2b-256 | 518aa77574c8a7d7cc0bafc5c1c001061898368c5bedacb741db45655da3ce7c |