Simple and customizable script that automatically creates and configures a new django project with user's own preferences. Designed for developers that create many django projects with the same structure.
It is also good for Django newbies, because after execution there is a working Django project.
Created projects are configured for working with newforms-admin branch.
Installation and usage:
cd [INSTALLATION_PATH] svn co https://dsnp.googlecode.com/svn/trunk/ dsnp cd [DJANGO_PROJECTS_ROOT] python [INSTALLATION_PATH]/dsnp.py [NEW_PROJECT_NAME]
Customization of the script:
Edit dsnp.py and modify any of following variables:
- APP_NAME: Name for your (first or only) django application (inside the project)
- ADMIN_NAME: Path for the django admin application
- SETTINGS_TEMPLATE: Your default settings.py file
- BASE_TEMPLATE: Your base.html file
Moving your project to a production environment
For moving your project to a production environment, as well as copying your project tree, you should do next steps:
- Edit env_settings.py and modify necessary values (probably all values, specially set DEBUG to False, and set up your production database)
- Set up your production web server. Here it is an apache + mod_python virtual host sample file:
<VirtualHost *:80>
ServerAdmin me@mydomain
DocumentRoot /var/www/myproject
ServerName mydomain
ErrorLog /var/log/apache2/mydomain_error_log
CustomLog /var/log/apache2/mydomain_access_log combined
<Location />
SetHandler python-program
PythonPath "['/opt/django/newforms-admin'] + ['/var/www'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonDebug Off
</Location>
<LocationMatch "/media/">
SetHandler None
</LocationMatch>
</VirtualHost>