Mercurial > hg > savane-forge
changeset 259:02f8038a2f3c
Improve install process
author | Sylvain Beucler <beuc@beuc.net> |
---|---|
date | Tue, 10 Aug 2010 20:21:36 +0200 (2010-08-10) |
parents | b0bc6bb1d07d |
children | c56fa3cf1b29 |
files | INSTALL public/.htaccess public/django.fcgi public/static_media savane/my/forms.py |
diffstat | 5 files changed, 42 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/INSTALL +++ b/INSTALL @@ -18,11 +18,12 @@ - PyME (GPG Made Easy for Python) - ssh-keygen (optional, to check submitted SSH public keys) - gpg (compute group keyrings) +- gettext (compile translations) As Debian packages: apt-get install python-django python-mysqldb python-yaml mysql-server python-pyme -apt-get install openssh-client gnupg +apt-get install openssh-client gnupg gettext hg clone http://bitbucket.org/offline/django-annoying/ hg clone http://bitbucket.org/ubernostrum/django-registration/ @@ -43,6 +44,10 @@ ./manage.py syncdb ./manage.py loaddata savane/*/fixtures/*.yaml +Compile the translations:: + + ./manage.py compilemessages + * Run for testing: @@ -61,60 +66,33 @@ SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE settings - #PythonOption django.root /myapp + #PythonOption django.root /savane PythonDebug On PythonPath "['/var/www/framework/src'] + sys.path" </Location> <Location "/media"> SetHandler None </Location> - <Location "/css"> - SetHandler None - </Location> - <Location "/images"> + <Location "/static-media"> SetHandler None </Location> Alias /media /usr/share/python-support/python-django/django/contrib/admin/media #Alias /media /usr/share/pyshared/django/contrib/admin/media - Alias /css /var/www/framework/media/css - Alias /images /var/www/framework/media/images + Alias /static-media /var/www/framework/static-media ** FCGI + suExec (shared hosting): http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/ apt-get install libapache2-mod-fcgid # _not_ mod-fastcgi which is non-free apt-get install python-flup +a2enmod rewrite httpd.conf: - DocumentRoot /var/www/framework/src + DocumentRoot /var/www/framework/public SuexecUserGroup myuser mygroup Alias /media /usr/share/python-support/python-django/django/contrib/admin/media #Alias /media /usr/share/pyshared/django/contrib/admin/media - Alias /css /var/www/framework/media/css - Alias /images /var/www/framework/media/images - - <Directory "/var/www/framework/src"> - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ savane.fcgi/$1 [qsappend,last] - </Directory> - -savane.fcgi (chmod 755): - -#!/usr/bin/python -import sys, os - -# Add a custom Python path. -sys.path.insert(0, "/var/www/framework/src") - -# Switch to the directory of your project. (Optional.) -# os.chdir("/home/user/myproject") - -# Set the DJANGO_SETTINGS_MODULE environment variable. -os.environ['DJANGO_SETTINGS_MODULE'] = "settings" - -from django.core.servers.fastcgi import runfastcgi -runfastcgi(method="threaded", daemonize="false") + # Cf. public/.htaccess for the rest of the configuration
new file mode 100644 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,4 @@ +#RewriteBase /savane +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ django.fcgi/$1 [qsappend,last]
new file mode 100755 --- /dev/null +++ b/public/django.fcgi @@ -0,0 +1,23 @@ +#!/usr/bin/env python +import sys, os + +# For security, do not place this file in the directory that contains +# your settings.py: it would allow an attacker to get it. + +# Add a custom Python path. +#sys.path.insert(0, "/var/www/myproject") +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + +# Switch to the directory of your project. (Optional.) +# os.chdir("/home/user/myproject") + +# Set the DJANGO_SETTINGS_MODULE environment variable. +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' + +from django.core.servers.fastcgi import runfastcgi +runfastcgi(method="threaded", daemonize="false") + +# Apparently the service needs to be installed at '/' + +# Your .fcgi needs to reside in suexec-docroot (compile-time +# constant), which is '/var/www' for Debian GNU/Linux
new file mode 120000 --- /dev/null +++ b/public/static_media @@ -0,0 +1,1 @@ +../static_media \ No newline at end of file
--- a/savane/my/forms.py +++ b/savane/my/forms.py @@ -48,7 +48,7 @@ try: ssh_key_fingerprint(ssh_key) - except Exception as e: + except Exception, e: raise forms.ValidationError(_("The uploaded string is not a public key file: %s") % e) return ssh_key @@ -66,7 +66,7 @@ ssh_key = ssh_key_file.read() try: ssh_key_fingerprint(ssh_key) - except Exception as e: + except Exception, e: raise forms.ValidationError(_("The uploaded file is not a public key file: %s") % e) return ssh_key_file