Skip to content

Commit

Permalink
Add ENV vars support
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurnn committed Dec 9, 2014
1 parent d1f7c37 commit c7848ce
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 50 deletions.
54 changes: 27 additions & 27 deletions cookbooks/vagrant_main/templates/default/vagrant.conf.erb
@@ -1,30 +1,30 @@
<VirtualHost *:80>
ServerName <%= node[:project_name] %>
ServerAdmin <%= node[:apache][:contact] %>
ServerAlias 0.0.0.0
LogLevel warn
ErrorLog <%= node[:apache][:log_dir] %>/<%= node[:project_name] %>_error.log
CustomLog <%= node[:apache][:log_dir] %>/<%= node[:project_name] %>_access.log combined

WSGIDaemonProcess <%= node[:project_name] %> user=www-data group=www-data maximum-requests=10000 python-path=/home/vagrant/env/lib/python2.6/site-packages
WSGIProcessGroup <%= node[:project_name] %>

WSGIScriptAlias / <%= node[:home_folder] %>/../deploy/django.wsgi


<Directory <%= node[:home_folder] %>/../deploy>
Order deny,allow
Allow from all
</Directory>

Alias /media/ /var/www/<%= node[:project_name] %>/media/
Alias /static/ /var/www/<%= node[:project_name] %>/static/
<Directory /var/www/<%= node[:project_name] %>/>
Order allow,deny
Allow from all
</Directory>
ServerName <%= node[:project_name] %>
ServerAdmin <%= node[:apache][:contact] %>
ServerAlias 0.0.0.0

LogLevel warn
ErrorLog <%= node[:apache][:log_dir] %>/<%= node[:project_name] %>_error.log
CustomLog <%= node[:apache][:log_dir] %>/<%= node[:project_name] %>_access.log combined

WSGIDaemonProcess <%= node[:project_name] %> user=www-data group=www-data maximum-requests=10000 python-path=/home/vagrant/env/lib/python2.6/site-packages
WSGIProcessGroup <%= node[:project_name] %>

SetEnv DJANGO_ENV development
WSGIScriptAlias / <%= node[:home_folder] %>/../deploy/django.wsgi

<Directory <%= node[:home_folder] %>/../deploy>
Order deny,allow
Allow from all
</Directory>

Alias /media/ /var/www/<%= node[:project_name] %>/media/
Alias /static/ /var/www/<%= node[:project_name] %>/static/

<Directory /var/www/<%= node[:project_name] %>/>
Order allow,deny
Allow from all
</Directory>

</VirtualHost>

13 changes: 7 additions & 6 deletions deploy/django.wsgi
Expand Up @@ -2,18 +2,19 @@

import os
import sys

from os.path import abspath, dirname, join
from site import addsitedir

sys.path.insert(0, abspath(join(dirname(__file__), "../source")))

os.environ['DJANGO_ENV'] = 'development'

from django.conf import settings
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

#sys.path.insert(0, join(settings.PROJECT_ROOT, "source"))

from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
_application = WSGIHandler()
def application(environ, start_response):
os.environ['AWS_ACCESS_KEY_ID'] = environ['AWS_ACCESS_KEY_ID']
os.environ['AWS_SECRET_ACCESS_KEY'] = environ['AWS_SECRET_ACCESS_KEY']
os.environ['DB_PASS'] = environ['DB_PASS']
os.environ['DJANGO_ENV'] = environ['DJANGO_ENV']
return _application(environ, start_response)
17 changes: 0 additions & 17 deletions deploy/django_uat.wsgi

This file was deleted.

0 comments on commit c7848ce

Please sign in to comment.