Error while deploying flask app on apache

2024/11/16 19:29:27

I have a file manage.py,

import os
from app import create_app
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
if __name__ == '__main__':app.run()

manage.py is working fine when tested in debug mode. However, I'm not able to host it on apache.

my wsgi file: start.wsgi

from manage import app as application
import sys
sys.stdout = sys.stderr

virtual host:

<VirtualHost *:80>ServerName domain.comWSGIDaemonProcess manage user=user group=user threads=5WSGIScriptAlias / /var/www/apioflifeapp/app/start.wsgi<Directory /var/www/apioflifeapp/app>Require all grantedOptions allAllowOverride allAllow from all</Directory>
</VirtualHost>

error in error log

 [Sat Feb 21 10:55:47.329450 2015] [:error] [pid 25422] [client 197.226.128.204:56062]   File "/var/www/apioflifeapp/app/start.wsgi", line 1, in <module>[Sat Feb 21 10:55:47.329601 2015] [:error] [pid 25422] [client 197.226.128.204:56062]     from manage import app as application[Sat Feb 21 10:55:47.329624 2015] [:error] [pid 25422] [client 197.226.128.204:56062] ImportError: No module named manage

i'm not understanding why i'm getting the import error

Answer

You need to import the app name from your actual application, not manage. Assuming it's apioflifeapp, you would import the following in start.wsgi instead:

from apioflifeapp import app as application
https://en.xdnf.cn/q/118891.html

Related Q&A

Selenium Python get_element by ID failing

Can someone help me understand why my code fails to find the element by ID. Code below:from selenium import webdriver driver=webdriver.Firefox() driver.get(https://app.waitwhile.com/checkin/lltest3/use…

Pipelining POST requests with python-requests

Assuming that I can verify that a bunch of POST requests are in fact logically independent, how can I set up HTTP pipelining using python-requests and force it to allow POST requests in the pipeline?D…

How to take a whole matrix as a input in Python?

I want to take a whole matrix as an input in Python and store it in a dataframe. Pandas can do it automatically with read_csv function but it requires a CSV file. I want to input/copy-paste a matrix di…

Cannot create environment in anaconda, update conda , install packages

CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/free/win-64/repodata.json.bz2 Elapsed: -An HTTP error occurred when trying to retrieve this URL. HTTP errors are often …

Inverted Triangle in Python-not running

I have to create a program to print an inverted triangle in python. When I was running it in Sublime Text 3 it did not run. By that, I mean that it did not even print a syntax error. def triangle():x =…

How to do Data profile to a table using pandas_profiling

When Im trying to do data profiling one sql server table by using pandas_profiling throwing an error like An attempt has been made to start a new process before thecurrent process has finished its boot…

Python replace line by index number

Is it possible in Python to replace the content of a line in a file by its index number?Would something like a line.replace to do this procedure?

print/list only 5 entries from OS.Walk in python

My Goal - To list only 5 entries when using OS walk. So far I have only been able to get a list of everything that I find using OS.Walk or only list one entry. (By using the return function) My code: i…

Numpy vectorisation of python object array

Just a short question that I cant find the answer to before i head off for the day,When i do something like this:v1 = float_list_python = ... # <some list of floats> v2 = float_array_NumPy = ... …

Python user must only enter float numbers

I am trying to find out how to make it so the user [only enters numbers <0] and [no letters] allowed. Can someone show me how I would set this up. I have tried to set up try/catch blocks but I keep …