Created
September 24, 2014 11:36
-
-
Save marcosgabarda/4158d13eee4502824b99 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# This file contains the WSGI configuration required to serve up your | |
# web application at http://cuble.pythonanywhere.com/ | |
# It works by setting the variable 'application' to a WSGI handler of some | |
# description. | |
# | |
# Below are templates for Django and Flask. You should update the file | |
# appropriately for the web framework you're using, and then | |
# click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site | |
# live. | |
# +++++++++++ CUSTOM WSGI +++++++++++ | |
# If you have a WSGI file that you want to serve using PythonAnywhere, perhaps | |
# in your home directory under version control, then use something like this: | |
# | |
#import os | |
#import sys | |
# | |
#path = '/home/cuble/path/to/my/app | |
#if path not in sys.path: | |
# sys.path.append(path) | |
# | |
#from my_wsgi_file import application | |
# +++++++++++ DJANGO +++++++++++ | |
# To use your own django app use code like this: | |
activate_this = '/home/cuble/.virtualenvs/cubledotes/bin/activate_this.py' | |
with open(activate_this) as f: | |
code = compile(f.read(), activate_this, 'exec') | |
exec(code, dict(__file__=activate_this)) | |
import os | |
import sys | |
# Passwords | |
os.environ['EMAIL_HOST'] = '' | |
os.environ['EMAIL_HOST_USER'] = '' | |
os.environ['EMAIL_HOST_PASSWORD'] = '' | |
os.environ['DB_NAME'] = '' | |
os.environ['DB_USER'] = '' | |
os.environ['DB_PASSWORD'] = '' | |
os.environ['DB_HOST'] = '' | |
os.environ['DB_PORT'] = '' | |
# | |
## assuming your django settings file is at '/home/cuble/mysite/settings.py' | |
paths = ['/home/cuble/cubledotes/cuble'] | |
for path in paths: | |
if path not in sys.path: | |
sys.path.append(path) | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'cuble.settings.production' | |
try: | |
import pymysql | |
pymysql.install_as_MySQLdb() | |
except ImportError: | |
pass | |
import django.core.handlers.wsgi | |
application = django.core.handlers.wsgi.WSGIHandler() | |
# +++++++++++ FLASK +++++++++++ | |
# Here is a simple Flask app. It is currently serving the default welcome | |
# page. You can adapt this if you want. | |
# | |
# If you're using a different web framework, you'll need to comment all of this | |
# out | |
# from flask import Flask | |
# application = Flask(__name__) | |
# @application.route('/') | |
# def hello_world(): | |
# return """ | |
# <html> | |
# <head> | |
# <title>Python Anywhere hosted web application</title> | |
# </head> | |
# <body> | |
# <h1>Hello, World!</h1> | |
# <p> | |
# This is the default welcome page for a | |
# <a href="https://www.pythonanywhere.com/">PythonAnywhere</a> | |
# hosted web application. | |
# </p> | |
# <p> | |
# Find out more about how to configure your own web application | |
# by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page | |
# </p> | |
# </body> | |
# </html>""" | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment