-
Notifications
You must be signed in to change notification settings - Fork 3
Setting up a server
yeealex93 edited this page Jun 1, 2012
·
11 revisions
- sudo apt-get install python
- sudo apt-get install git, git-doc, and git-core
- Generate an ssh key and add it to your github profile (for a walkthrough, go to your dashboard on github, go to profile -> SSH Public Keys -> Need help with public keys? )
- Clone the repo into the directory of your choice (we've been using /var/www/)
- git clone [email protected]:scattering/dataflow.git
- From the main project directory, run the python install script: sudo -s python install.py
- Create a FILES directory to store files for reductions. In settings.py (in the main dataflow directory), update FILES_DIR to point at the FILES directory you created.
- Possible issues at this stage:
- Installing psycopg2 / getting the dependencies (the install script ought to take care of this)
- From the main project directory, run python manage.py runserver [IPaddress:port]
- Run python manage.py syncdb once you have set up a database (either postgresql or sqlite3 - see settings.py)
- Possible issues at this stage:
- sys.path does not have all of the necessary paths in manage.py
-
Check in the project's apache folder for a .wsgi file. This file needs to:
- set the environmental variable DJANGO_SETTINGS_MODULE to PROJECT_NAME.settings
- import django.core.handlers.wsgi
- set up a wsgi handler object, application = django.core.handlers.wsgi.WSGIHandler()
- possible issue: sys.path does not have all of the necessary paths.
-
Add a dataflow site in /etc/apache2/sites-available and /etc/apache2/sites-enabled. This is a file that looks like:
<VirtualHost *:80> ServerName 129.2.64.185 DocumentRoot /var/www/ Alias /static/ "/var/www/DATAFLOW/static/" Alias /site_media/ "/var/www/DATAFLOW/static/" <Directory "/var/www/DATAFLOW/static/"> Order allow,deny #Options Indexes Allow from all #IndexOptions FancyIndexing </Directory> <Directory /var/www/DATAFLOW/> Options +FollowSymLinks +Includes +Indexes Order deny,allow Allow from all </Directory> <Directory /var/www/DATAFLOW/apps/tracks/> Allow from all </Directory> KeepAlive Off LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined #LogLevel info SetEnvIf X-Forwarded-SSL on HTTPS=1 WSGIScriptAlias / /var/www/DATAFLOW/apache/django.wsgi </VirtualHost>
- You can simply copy this file, changing the paths to match the location of the cloned project, and changing the IP address
- Change the port in etc/apache2/sites-available/default to something other than 80. Alternately, set the dataflow port to something other than 80 in both sites-available and sites-enabled.
- Add the line ServerName [IP address] to the file /etc/apache2/httpd.conf
- Try running your server with /usr/sbin/apache2ctl start
- The commands 'stop' and 'restart' are also available
- Check out the project at [IPaddress:port]
- If the server is not running properly, or you are getting non-apache errors (e.g., Django errors) on visiting the project site, check the error log (/var/log/apache2/error.log)