Flask 500 error
3 posts
• Page 1 of 1
Flask 500 error
Hello,
For some reason my Flask app does not work on the server.
Here is what I did:
1) Fresh win 2106 server installed
2) Latest Helicon Zoo standalone installer (because I want to use python 3.4)
Everything was installed and I can see welcome page.
I have created default "hello world" Flask app using PyCharm. It works on :5000
Then I copy this file to the root (where my welcome.py file is)
In .zoo file I change wsgi_handler to testapp.py and since I'm using the same directory I don't change anything in PYTHON_PATH
Here is the error I'm getting:
Traceback (most recent call last):
File "C:\Zoo\Python34\Lib\site-packages\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "C:\Zoo\Python34\Lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "C:\Zoo\Python34\Lib\site-packages\wfastcgi.py", line 603, in get_wsgi_handler
handler = getattr(handler, name)
AttributeError: 'module' object has no attribute 'application'
Could you please help me out with thing.
My .zoo file:
application:
application: PythonProject
title: Python sample project
description: |
This sample Python project provides instruction how to run Python applications with Helicon Zoo.
Please use this project as a starting point for your Python application deployment.
This project can run on both Python 2.7 and Python 3.7, but once it is set up python version cannot be
easily switched as it uses virtualenv.
link: http://www.helicontech.com/zoo/
author: Helicon Tech
icon: http://www.helicontech.com/zoo4_feed/Te ... 00x100.png
tags:
- template
eula: http://www.helicontech.com/zoo/license.html
os: windows
version: '1.0'
installed_version: ''
dependencies:
- or:
- Python34.FCGI.Engine
- Python34.HTTP.Engine
- Python27.FCGI.Engine
- Python27.HTTP.Engine
files:
- file: http://www.helicontech.com/zoo4_feed/Te ... mplate.zip
filename: template.zip
install_command: |-
install_path = parameters['physical-path']
os.un7zip(files[0].path, install_path )
windows.set_write_permission(install_path, 'IIS_IUSRS')
os.chdir(install_path)
if not os.path_exists('venv'):
os.cmd(r'virtualenv.exe venv --clear')
os.cmd(r'venv\scripts\pip.exe install --requirement=requirements.txt')
parameters:
site-name: Default Web Site
create-app: true
app-name: /
selected-engine: Python34.FCGI.Engine
app-pool-name: DefaultAppPool
physical-path: C:\inetpub\wwwroot
engines:
- engine: Python34.FCGI.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
WSGI_HANDLER: testapp.application
- engine: Python34.HTTP.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
HTTP_WORKER: tornado_worker.py
- engine: Python27.FCGI.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
WSGI_HANDLER: testapp.application
- engine: Python27.HTTP.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
HTTP_WORKER: tornado_worker.py
database_type: null
start_page: null
locations:
- path: static
engine: none
- path: '*'
engine: Python34.FCGI.Engine
name: PythonProject
has_upgrade: false
is_upgradable: false
For some reason my Flask app does not work on the server.
Here is what I did:
1) Fresh win 2106 server installed
2) Latest Helicon Zoo standalone installer (because I want to use python 3.4)
Everything was installed and I can see welcome page.
I have created default "hello world" Flask app using PyCharm. It works on :5000
Then I copy this file to the root (where my welcome.py file is)
In .zoo file I change wsgi_handler to testapp.py and since I'm using the same directory I don't change anything in PYTHON_PATH
Here is the error I'm getting:
Traceback (most recent call last):
File "C:\Zoo\Python34\Lib\site-packages\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "C:\Zoo\Python34\Lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "C:\Zoo\Python34\Lib\site-packages\wfastcgi.py", line 603, in get_wsgi_handler
handler = getattr(handler, name)
AttributeError: 'module' object has no attribute 'application'
Could you please help me out with thing.
My .zoo file:
application:
application: PythonProject
title: Python sample project
description: |
This sample Python project provides instruction how to run Python applications with Helicon Zoo.
Please use this project as a starting point for your Python application deployment.
This project can run on both Python 2.7 and Python 3.7, but once it is set up python version cannot be
easily switched as it uses virtualenv.
link: http://www.helicontech.com/zoo/
author: Helicon Tech
icon: http://www.helicontech.com/zoo4_feed/Te ... 00x100.png
tags:
- template
eula: http://www.helicontech.com/zoo/license.html
os: windows
version: '1.0'
installed_version: ''
dependencies:
- or:
- Python34.FCGI.Engine
- Python34.HTTP.Engine
- Python27.FCGI.Engine
- Python27.HTTP.Engine
files:
- file: http://www.helicontech.com/zoo4_feed/Te ... mplate.zip
filename: template.zip
install_command: |-
install_path = parameters['physical-path']
os.un7zip(files[0].path, install_path )
windows.set_write_permission(install_path, 'IIS_IUSRS')
os.chdir(install_path)
if not os.path_exists('venv'):
os.cmd(r'virtualenv.exe venv --clear')
os.cmd(r'venv\scripts\pip.exe install --requirement=requirements.txt')
parameters:
site-name: Default Web Site
create-app: true
app-name: /
selected-engine: Python34.FCGI.Engine
app-pool-name: DefaultAppPool
physical-path: C:\inetpub\wwwroot
engines:
- engine: Python34.FCGI.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
WSGI_HANDLER: testapp.application
- engine: Python34.HTTP.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
HTTP_WORKER: tornado_worker.py
- engine: Python27.FCGI.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
WSGI_HANDLER: testapp.application
- engine: Python27.HTTP.Engine
environment_variables:
VIRTUAL_ENV: '%APPL_PHYSICAL_PATH%\venv'
PATH: '%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%'
PYTHONPATH: '%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project'
ERROR_LOG_DIR: log
HTTP_WORKER: tornado_worker.py
database_type: null
start_page: null
locations:
- path: static
engine: none
- path: '*'
engine: Python34.FCGI.Engine
name: PythonProject
has_upgrade: false
is_upgradable: false
Re: Flask 500 error
Problem solved.
Since my Flask is "app" I had to put testapp.app instead of testapp.application in my config file.
Since my Flask is "app" I had to put testapp.app instead of testapp.application in my config file.
Re: Flask 500 error
Maybe try turn to supports team? they will help you, i'm confident. I heard Flesk gonna buy case study and order some programmer to solve server problems.
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests