Skip to content

Instantly share code, notes, and snippets.

@ttx
Created September 16, 2015 16:24
Show Gist options
  • Save ttx/cd7a138cebb65397a477 to your computer and use it in GitHub Desktop.
Save ttx/cd7a138cebb65397a477 to your computer and use it in GitHub Desktop.
odsreg setup extra files
import os
import sys
path = '/var/www/summit'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'odsreg.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
# Install software
sudo apt-get install libapache2-mod-wsgi
sudo apt-get install python-django python-django-auth-openid
# Install ODSREG
cd /var/www
sudo mkdir summit
sudo chown ttx:ttx summit
cd summit
git clone https://github.com/ttx/odsreg
cd odsreg
# Set up local settings and static directory
cp local_settings.py.sample local_settings.py
vi local_settings.py
mkdir ../static
./manage.py collectstatic
# Set up DB
mkdir ../db
sudo chown www-data:ttx ../db
./manage.py syncdb
sudo chown www-data:ttx ../db/summit.db
sudo chmod g+w ../db/summit.db
# Load topics
cp topics.json.sample topics.json
vi topics.json
./manage.py loadtopics topics.json
# Set up Apache config
vi ../django.wsgi
sudo vi /etc/apache2/sites-available/default
sudo apache2ctl restart
<VirtualHost *:80>
ServerAdmin me@example.org
WSGIScriptAlias / /var/www/summit/django.wsgi
Alias /media/ /var/www/summit/static/
Alias /static/admin/ /usr/share/pyshared/django/contrib/admin/media/
<Directory /usr/share/pyshared/django/contrib/admin/media>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/summit/static>
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment