Skip to content

Commit

Permalink
Wsgi/uwsgi config files check in
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytan4ever committed Apr 17, 2015
1 parent 414661c commit 6b0c50e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions deployment/uwsgi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<uwsgi id="styles">
<socket>/tmp/styles.sock</socket>
<master/>
<chdir>/srv/styles_webapp/</chdir>
<module>wsgi</module>
<pidfile>/tmp/styles.pid</pidfile>
<daemonize>/var/log/uwsgi/styles.log</daemonize>
<processes>4</processes>
<harakiri>60</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<uid>uwsgi</uid>
<gid>www-data</gid>
<vacuum/>
</uwsgi>
30 changes: 30 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-

import sys, os, pwd

project = "Styles"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

BASE_DIR = os.path.join(os.path.dirname(__file__))
# activate virtualenv
#activate_this = os.path.join(BASE_DIR, "env/bin/activate_this.py")
#execfile(activate_this, dict(__file__=activate_this))

if BASE_DIR not in sys.path:
sys.path.append(BASE_DIR)

# give wsgi the "application"
from shell import create_app

# default to dev config because no one should use this in
# production anyway
env = os.environ.get('STYLES_ENV', 'dev')
application = create_app('shell.styles.settings.%sConfig' % env.capitalize(), env=env)

if __name__ == '__main__':
application.run()

0 comments on commit 6b0c50e

Please sign in to comment.