SHARE
TWEET

Untitled

a guest Jan 20th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ├── folder
  2. │   └── routes.py
  3. ├── hello.conf
  4. ├── hello.py
  5. ├── hello.wsgi
  6. └── README.md
  7.    
  8. from flask import Flask
  9. from folder.routes import simple_page # works in dev but not with wsgi.. Why?
  10.  
  11.  
  12. app = Flask(__name__)
  13. app.register_blueprint(simple_page)
  14.    
  15. from flask import Blueprint, render_template, abort
  16. from jinja2 import TemplateNotFound
  17.  
  18. simple_page = Blueprint('simple_page', __name__,
  19.                         template_folder='templates')
  20.  
  21. @simple_page.route('/')
  22. def index():
  23.     try:
  24.         return "Hello world"
  25.     except TemplateNotFound:
  26.         abort(404)
  27.    
  28. <VirtualHost *>
  29.     ServerName example.com
  30.     WSGIScriptAlias / /var/www/myfirstapp/hello.wsgi
  31.     WSGIDaemonProcess hello python-path=/var/www/myfirstapp:/var/www    /myfirstapp/.env/lib/python3.5/site-packages
  32.     <Directory /var/www/myfirstapp>
  33.        WSGIProcessGroup hello
  34.        WSGIApplicationGroup %{GLOBAL}
  35.         Order deny,allow
  36.         Allow from all
  37.     </Directory>
  38. </VirtualHost>
  39.    
  40. import sys
  41. sys.path.insert(0, "/var/www/myfirstapp")
  42. from hello import app as application
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top