python - 404 Exception when deploying a Flask application via mod_wsgi -
my question similar 1 asked here. have flask application runs fine on local machine. want upload application online , followed steps under mod_wsgi given here. reason, url's seek access giving me 404 on server. code snippets follows.
httpd.conf file
<virtualhost *:80> servername abc.com serveralias www.abc.com serveradmin myusername@gmail.com errorlog /path/to/error/logs/error.log customlog /path/to/error/logs/access.log combined wsgiscriptalias / /path/to/wsgi/file/app.wsgi <directory /path/tp/wsgi/folder> order deny,allow allow </directory> </virtualhost>
app.wsgi
activate_this = '/path/to/activate/file/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) # set path import sys sys.path.insert(0, '/path/to/home/dir') app import app application if __name__ == "__main__": application.run()
init.py under app
# import flask , template operators flask import flask, render_template flask.ext.mongoengine import mongoengine # define wsgi application object app = flask(__name__) app.config["mongodb_settings"] = {'db': "dbname"} app.config["secret_key"] = "secret" db = mongoengine(app) # sample http error handling @app.errorhandler(404) def not_found(error): homecoming "todo: 404 page", 404 app.data.controllers import mod_data mod_data app.list.controllers import mod_list mod_list # register blueprint(s) app.register_blueprint(mod_data) app.register_blueprint(mod_list)
my directory construction below:
. ├── app │ ├── controllers.py │ ├── info │ ├── __init__.py │ ├── __init__.pyc │ ├── list │ ├── static │ └── templates ├── application.py ├── app.wsgi ├── config.py ├── env │ ├── bin │ ├── include │ └── lib ├── input.csv ├── new-input.csv └── run.py
python mod-wsgi flask
No comments:
Post a Comment