We are trying to deploy a Python flask application on Azure but keep on reciving 500 error with following trace .
StdErr:
2014-09-22 19:24:07.347000: Unhandled exception in wfastcgi.py: Traceback (most recent call last):
File "D:\Python27\Scripts\wfastcgi.py", line 710, in main
env, handler = read_wsgi_handler(response.physical_path)
File "D:\Python27\Scripts\wfastcgi.py", line 567, in read_wsgi_handler
return env, get_wsgi_handler(handler_name)
File "D:\Python27\Scripts\wfastcgi.py", line 550, in get_wsgi_handler
raise ValueError('"%s" could not be imported' % handler_name)
ValueError: "cpmapp.app" could not be imported
2014-09-22 19:24:07.370000: wfastcgi.py 2.1.0 closed
Can anyone help ?
I've had similar issues understanding why my apps were failing on Azure.
I'm assuming you're using Azure Web Apps?
You must configure your deployment using 2 important files (web.config & deploy.cmd) and adding a requirements.txt file with the list of dependencies.
I have a blog post breaking it down
This post helped me understand what Azure is doing.
Related
I am facing an issue in pipeline deployment with Zappa - unable to update lambda configuration. It shows below error
Traceback (most recent call last):
File "/var/lang/lib/python3.7/site-packages/zappa/cli.py", line 3415, in handle
sys.exit(cli.handle())
File "/var/lang/lib/python3.7/site-packages/zappa/cli.py", line 588, in handle
self.dispatch_command(self.command, stage)
File "/var/lang/lib/python3.7/site-packages/zappa/cli.py", line 644, in dispatch_command
self.vargs["docker_image_uri"],
File "/var/lang/lib/python3.7/site-packages/zappa/cli.py", line 1174, in update
wait=False,
File "/var/lang/lib/python3.7/site-packages/zappa/core.py", line 1408, in update_lambda_configuration
if lambda_aws_config["PackageType"] != "Image":
KeyError: 'PackageType'
It was working previously file but now when I run the pipeline its starts failing. I have not done any changes to requirements.txt it is the same as the previous successful pass.
The version of Python is 3.7 and
AWS is running in us-east-1 region.
Upgrade to Zappa 0.54.1 fixes this issue as a wait function has been included to collect the correct key params from AWS.
I have IIS setup with fastCGI, serving a flask app. So far so good. Next I whish to add some database connectivity, so I add the line import cx_Oracle to my app. Now this error is thrown:
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 616, in get_wsgi_handler
raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "Bloomberg_server.app" could not be imported:
Traceback (most recent call last):
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 600, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File "D:\website\init__.py", line 6, in import cx_Oracle
ImportError: DLL load failed: The specified module could not be found. StdOut: StdErr:
As the title suggests I fail to reproduce the issue in a controlled environment. The very same import statement works fine in the conda environment and moreover, I can run the Flask debug server just fine with pages that rely on a database connection.
I am at loss. Who has a clue what's going on here? The path/oracle_home variables are pointing to the instant client and I have only one python environment installed.
I am too embarrased to admit how long this has taken me, but I've found the answer.
FastCGI's core business is keeping subprocesses alive so that subsequent calls to the server do not require booting a Python environment. In other words, after installing a python package it is advised to reboot. I solved my first question on SO by rebooting..
The answer to this question got me thinking in the right direction.
I'm running google app engine, python 2.7, and importing Django 1.8. After pulling in python-firebase (-e git://github.com/ozgur/python-firebase.git#egg=python-firebase), I get the following error
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/base/data/home/apps/s~trac-us/1.392706776803493304/main.py", line 25, in <module>
application = django.core.wsgi.get_wsgi_application()
File "/base/data/home/apps/s~trac-us/1.392706776803493304/libs/django/core/wsgi.py", line 14, in get_wsgi_application
django.setup()
File "/base/data/home/apps/s~trac-us/1.392706776803493304/libs/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/base/data/home/apps/s~trac-us/1.392706776803493304/libs/django/apps/registry.py", line 78, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
Many of the other solutions have suggested to alter the wsgi.py file, because django gets installed right before deployment in the requirements.txt file.
Ultimately this leads to the server stating: "Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds." How can I resolve this?
I was facing the same issue and removing the database configuration for a sqlite database connection fixed this for me. Issue might've been that the sqlite library that django is looking for underneath was not present and thus, removing the sqlite configuration fixed that for me. pff, I was not using sqlite in that project any way.
However, as per a google groups thread I landed on, the error:
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
is caused when one of the application that you're trying to load leads to an error within, which leads to this. I'll provide a link to the thread here, and although it's different from your problem(you probably solved it already), you might still find it useful:
Link to groups thread
The answer I was talking about
Hope you find it useful.
I see the following error in the log file:
Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.pyc", line 486, in __bootstrap_inner
File "launcher\taskthread.pyc", line 65, in run
File "subprocess.pyc", line 594, in __init__
File "subprocess.pyc", line 816, in _execute_child
WindowsError: [Error 5] Access is denied
WindowsError: [Error 5] Access is denied
In Windows I used to see this error myself after installing Google App Engine SDK for PHP. This error occured when gae could not find the PHP executable.
The thing was I was specifying the absolute path to the folder that contained php-cgi.exe, leaving out the name of the executable php-cgi.exe! I solved this problem by adding the name of tyhe executable as well. So you might want to take a look again at your absolute path and make corrections.
from the docs:
Start the web server with the following command, giving it the path to
your project directory:
google_appengine/dev_appserver.py --php_executable_path=absolute-path-to-php-cgi.exe myproject/
Hope it helps,
I'm trying to learn Python and figured I'd build an app to host on GAE because it's free.
I'm following this guide here: http://code.google.com/appengine/docs/python/gettingstartedpython27/helloworld.html
and have the exact files: helloworld.py and app.yaml inside my helloworld directory but when I launch it I get this error:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 225, in _LoadHandler
handler = __import__(path[0])
ImportError: No module named helloworld
INFO 2012-03-21 19:36:47,219 dev_appserver.py:2865] "GET / HTTP/1.1" 500 -
Python is still greek to me and it's no fun struggling with environment configuration when you're new to something. What did I do wrong? Does it matter than I have GAE/J installed?