Missing pages with flash drives administrators
I am trying to deploy my Flask application using Apache and mod_wsgi on an Ubuntu server.
This seems to be ok for the quiet requests I've done, but I can't access the Flask-Admin pages (which I can access in development).
Here is the structure of my application (simplified for this question):
- MyApp/
- main.py
- myapp/
- __init__.py
- Views.py
- files/
- wsgi/
myapp.wsgi
When developing, I just run with python main.py and everything works fine.
Here is the wsgi file:
import sys
import os
##Virtualenv Settings
activate_this = '/var/www/code/MyApp/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
##Replace the standard out
sys.stdout = sys.stderr
##Add this file path to sys.path in order to import settings
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..'))
##Add this file path to sys.path in order to import app
sys.path.append('/var/www/code/MyApp/')
from myapp import app as application
Here is the config file for Apache, I am using Apache 2.2:
<VirtualHost *:443>
WSGIScriptAlias /myapp /var/www/code/MyApp/wsgi/myapp.wsgi
WSGIScriptReloading On
WSGIPassAuthorization On
SSLEngine on
SSLCertificateFile /var/www/code/MyApp/ssl.crt
SSLCertificateKeyFile /var/www/code/MyApp/ssl.key
SSLVerifyClient None
SSLOptions +StdEnvVars
<Directory /var/www/code/MyApp/wsgi>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
This is how I create a Flask application in my __ init __.py:
app = Flask(__name__, static_folder='files')
This is how I create the admin interface in my main.py:
# Create admin
admin = admin.Admin(app, 'App Administration')
I also have a link to the admin page in my Views.py:
@app.route('/')
def index():
return '<a href="/admin/">Go to admin page</a>'
While developing, I can access the admin interface at mysite.com/admin/.
In production, I have an app at mysite.com/myapp/ and I can't access the admin interface I expected from mysite.com/myapp/admin/.
I think there is a problem with the way I create checkbox-admin. I kept the default "admin /" url, but maybe I need to declare a specific url in production?
Thanks for any help.
EDIT:
I have checked the Apache error log, but I am not getting any errors.
Have you tried updating your route with "myapp"? It looks like you need to update your route for production. It may even be able to drop the '/' to production. Try it.
@app.route('/')
@app.route('/myapp/')
def index():