Help with setting up a Flask application.

Repository of web frameworks and applications for Microsoft IIS.
User avatar
Posts: 3
Joined: 07 Feb 2014, 19:39

Help with setting up a Flask application.

07 Feb 2014, 20:22

Ok, for test I have basic flask application like given on the flask page named main.py in the folder myproject. Here is my code:
Code: Select all
from flask import Flask
application = app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()


Then I install the Helicon Zoo Python Hosting project template and put it into folder named flask under wwwroot on my IIS.
What do I have to do to be able to run this application on the IIS? I have tried to set
<!-- generic wsgi app -->
<add name="WSGI_APP" value="main.application" />

And set PYTHONPATH to:
<add name="PYTHONPATH" value="%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%C:\inetpub\wwwroot\flask\myproject;" />


But when I run my page I always get error page.
Code: Select all
500 Error

Helicon Zoo module has caught up an error. Please see the details below.
 
Worker Status

The process was created

Windows error

The pipe has been ended. (ERROR CODE: 109)

Internal module error

message: ZooApplication backend read Error. type: ZooException file: Jobs\JobBase.cpp line: 566 version: 3.1.98.508

STDERR 

Empty stderr


Can someone please help me get this app to run on my IIS? I am not experienced with this server config stuff :roll:
Should I make separated wsgi.py file? What would it include and how would I connect it to my views í main.py?

User avatar
Posts: 110
Joined: 07 Mar 2012, 10:22

Re: Help with setting up a Flask application.

10 Feb 2014, 08:24

Hello!

I have ran this example flask app on IIS Express with following steps:

1. Install Python project template (New IIS Express web site will be created).
2. Open web console in <you app url>/console (see right link at welcome page) and run 'pip install flask' to install flask in local virtualenv.
3. Place main.py to app root (near web.config).
4. Update web.config:
Code: Select all
<add name="WSGI_APP" value="welcome.application" />

update to
Code: Select all
<add name="WSGI_APP" value="main.application" />


Full web.config: https://gist.github.com/rukeba/8914074

That`s all, refresh app page in browser.

Note that if you install template in IIS (not IIS Express) not into the site root but into some folder, e.g. myproject, remember:
1. this folder must be a module, i.e. must contain a __init__.py file and you WSGI_APP will be 'myproject.main.application',
2. URLs in your Flask app should account for this: @app.route("/myproject/")

Thanks!

User avatar
Posts: 3
Joined: 07 Feb 2014, 19:39

Re: Help with setting up a Flask application.

10 Feb 2014, 19:02

Thank you! It is running now!

User avatar
Posts: 2
Joined: 11 Apr 2017, 15:15

Re: Help with setting up a Flask application.

19 Jun 2017, 00:30

It is the way to get the gta 5 money generator for the cheats and hack for the gta 5 game and it is proving to be useful.

User avatar
Posts: 1
Joined: 28 Feb 2018, 08:03

Re: Help with setting up a Flask application.

28 Feb 2018, 08:06

<a title="link building service" href="http://www.hstecsol.com/seo.html">link building service</a>

Return to Helicon Zoo

Who is online

Users browsing this forum: No registered users and 15 guests