I have this structure,
index.py
run.py
app/
__init__.py
routes.py
templates/
...
index.py,
import os
import sys
activate_this = os.path.dirname(__file__) + '/venv/Scripts/activate_this.py'
exec(open(activate_this).read(), dict(__file__ = activate_this))
# Expand Python classes path with your app's path.
sys.path.insert(0, os.path.dirname(__file__))
from run import app
#Initialize WSGI app object.
application = app
run.py,
from flask import Flask
app = Flask(__name__)
from app import routes
if __name__ == '__main__':
app.run()
app/routes.py,
from run import app
from flask import Flask, render_template
@app.route('/')
def hello_world():
return 'Hello World'
@app.route('/dave')
def myDave():
return 'Hello World - From Dave'
@app.route('/home')
def home():
return render_template('home.html')
@app.route('/about')
def about():
return render_template('about.html')
app/__init__.py
,
(blank)
So when I access the app with /
I get Hello World
which is correct, and /dave
I get Hello World - From Dave
But with /home
and /about
, I get 500 Internal Server Error
The log file does not give much info about the error at all,
[Fri Aug 21 19:47:06.992431 2015] [mpm_winnt:notice] [pid 7036:tid 244] AH00418: Parent: Created child process 5872 [Fri Aug 21 19:47:07.257631 2015] [wsgi:warn] [pid 5872:tid 244] mod_wsgi: Compiled for Python/2.7.9+. [Fri Aug 21 19:47:07.257631 2015] [wsgi:warn] [pid 5872:tid 244] mod_wsgi: Runtime using Python/2.7.10. [Fri Aug 21 19:47:07.273231 2015] [mpm_winnt:notice] [pid 5872:tid 244] AH00354: Child: Starting 64 worker threads.
But it seems that the module render_template
from Flask is not loaded or not working.
Any ideas what have I done wrong?