Commit ad2762cf authored by Jeremy Kerr's avatar Jeremy Kerr
Browse files

Move to a more recent django project structure



This change updates patchwor to the newer project struture: we've moved
the actual application out of the apps/ directory, and the
patchwork-specific templates to under the patchwork application.

This gives us the manage.py script in the top-level now.
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
parent f09e982f
......@@ -43,9 +43,9 @@ It's always a good idea to use virtualenv to develop python software.
5. Now one can run patchwork within that environment
(django-1.7)$ ./apps/manage.py --version
(django-1.7)$ ./manage.py --version
1.7
(django-1.7)$ ./apps/manage.py runserver
(django-1.7)$ ./manage.py runserver
6. To exit the virtual environment
......
......@@ -135,8 +135,7 @@ in brackets):
Then, get patchwork to create its tables in your configured database:
cd apps/
PYTHONPATH=../lib/python ./manage.py syncdb
PYTHONPATH=lib/python ./manage.py syncdb
And add privileges for your mail and web users. This is only needed if
you use the ident-based approach. If you use password-based database
......@@ -190,7 +189,7 @@ in brackets):
Once you have apache set up, you can start the fastcgi server with:
cd /srv/patchwork/apps
cd /srv/patchwork/
./manage.py runfcgi method=prefork \
socket=/srv/patchwork/var/fcgi.sock \
pidfile=/srv/patchwork/var/fcgi.pid
......@@ -222,14 +221,14 @@ in brackets):
directory. (Note, do not use the parsemail.py script directly). Something
like this in /etc/aliases is suitable for postfix:
patchwork: "|/srv/patchwork/apps/patchwork/bin/parsemail.sh"
patchwork: "|/srv/patchwork/patchwork/bin/parsemail.sh"
You may need to customise the parsemail.sh script if you haven't installed
patchwork in /srv/patchwork.
Test that you can deliver a patch to this script:
sudo -u nobody /srv/patchwork/apps/patchwork/bin/parsemail.sh < mail
sudo -u nobody /srv/patchwork/patchwork/bin/parsemail.sh < mail
7. Set up the patchwork cron script
......@@ -240,9 +239,9 @@ in brackets):
Something like this in your crontab should work:
# m h dom mon dow command
PYTHONPATH=apps:.
PYTHONPATH=.
DJANGO_SETTINGS_MODULE=settings
*/10 * * * * cd patchwork; python apps/patchwork/bin/patchwork-cron.py
*/10 * * * * cd patchwork; python patchwork/bin/patchwork-cron.py
- the frequency should be the same as the NOTIFICATION_DELAY_MINUTES
......
......@@ -7,7 +7,7 @@ NameVirtualHost patchwork.example.com:80
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/srv/patchwork/apps', '/srv/patchwork/lib/python'] + sys.path"
PythonPath "['/srv/patchwork', '/srv/patchwork/lib/python'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE settings
</Location>
......
......@@ -12,8 +12,7 @@ import sys
basedir = os.path.join(
os.path.dirname(__file__), os.path.pardir, os.path.pardir)
sys.path.append(basedir)
sys.path.append(os.path.join(basedir, 'apps'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'apps.settings'
os.environ['DJANGO_SETTINGS_MODULE'] = 'patchwork.settings.prod'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
......@@ -20,10 +20,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
BIN_DIR=`dirname $0`
PATCHWORK_BASE=`readlink -e $BIN_DIR/../../..`
PATCHWORK_BASE=`readlink -e $BIN_DIR/../..`
PYTHONPATH="$PATCHWORK_BASE/apps":"$PATCHWORK_BASE/lib/python:$PYTHONPATH" \
PYTHONPATH="$PATCHWORK_BASE":"$PATCHWORK_BASE/lib/python:$PYTHONPATH" \
DJANGO_SETTINGS_MODULE=settings \
"$PATCHWORK_BASE/apps/patchwork/bin/parsemail.py"
"$PATCHWORK_BASE/patchwork/bin/parsemail.py"
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment