Created
September 10, 2014 01:47
-
-
Save citmusa/14c646d54a6ab6ede973 to your computer and use it in GitHub Desktop.
alwaysdata django app deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################## | |
### .htaccess | |
### /(manage.py dir)/public | |
########################## | |
AddHandler fcgid-script .fcgi | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################## | |
### django.fcgi | |
### /(manage.py dir)/public | |
########################## | |
# python bin path in virtual env | |
#!/nfs/http7/changodjango/vjean/bin/python | |
import os, sys | |
venv = '/nfs/http7/changodjango/vjean/bin/activate_this.py' | |
execfile(venv, dict(__file__=venv)) | |
_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
sys.path.insert(0, _PROJECT_DIR) | |
sys.path.insert(0, os.path.dirname(_PROJECT_DIR)) | |
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1] | |
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings.production" % _PROJECT_NAME | |
from django.core.servers.fastcgi import runfastcgi | |
runfastcgi(method="threaded", daemonize="false") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################ | |
### settings.production.py | |
############################ | |
ALLOWED_HOSTS = ['user.alwaysdata.net'] | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
PROJECT_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', '..') | |
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') | |
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'public', 'static') | |
STATIC_URL = '/static/' if DEBUG else 'http://user.alwaysdata.net/static/' | |
STATICFILES_DIRS = ( | |
os.path.join(PROJECT_ROOT, 'static'), | |
) | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', | |
'HOST': 'mysql1.alwaysdata.com', | |
'NAME': 'dbname', | |
'USER': '96608', | |
'PASSWORD': 'password', | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment