Pyramid-debugging a resource cannot be found error - python

What are possible causes of "The resource could not be found" error in Pyramid?
From my limited exeperiece debugging my Pyramid app, errors with routes and Python syntax error trigger a more explicit error message.
Is there a way to get the development server to trace a request (similiar to the way running a rails server does it)? I tried running paster in verbose mode, but am not getting any more information.

So that's a HTTPNotFound error, which Pyramid has a debugging option for to help you out.
https://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/viewconfig.html#notfound-errors

Related

503 Litespeed Python error: The server is temporarily busy, try again later

I am using shared linux hosting and I am trying to setup a Python app using the Python selector. Firstly, when you setup the app, the website should be saying:
It works! and the python version.
However I am getting a 503 error saying The server is temporarily busy, try again later!.
I tried setting up an app using the NodeJS selector and it worked without a problem. The server that the hosting uses is Litespeed. I have no root access.
If anyone can help, I will be very thankful!

Gunicorn log errors in Google Cloud Platform

I am running a Django REST API on Google Kubernetes Engine, using Gunicorn for my WSGI server. When my application encounters a 500 server error, the Python stack trace is not showing up in the GCP Logging console (in the "GKE Container" resource). In a different Django project of mine which uses Daphne for the ASGI/WSGI server, this traceback is being properly logged. Even more strange, the Gunicorn application has properly logged errors before, just a few weeks ago. Those errors appear in the Error Reporting console as well.
To be clear, this is the type of information that I would like to see in the GCP logs:
Internal Server Error: /v1/user/errant-endpoint
Traceback (most recent call last):
File "/path/to/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
...
File "/path/to/project/file.py", line 176, in my_file
print(test)
NameError: name 'test' is not defined
For the Gunicorn project, some of the Python tracebacks are logged, like this one when Gunicorn is started:
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1421: RuntimeWarning: DateTimeField User.last_login received a naive datetime (2019-02-04 05:49:47.530648) while time zone support is active.
With 500 errors, however, only the HTTP info is logged:
[04/Feb/2019:06:03:58 +0000] "POST /v1/errant-endpoint HTTP/1.1" 500
I've looked up the resources for setting up Stackdriver Logging and Stackdriver Error Reporting, but neither of these seem to apply because 1) that only appears to work when you want to explicitly log your errors (as in client.report_exception()), and 2) Error Reporting has caught previous errors without my setting up, so it seems to be possible without having to install those client libraries.
There are so many variables at play here that I'm not sure where to start. I may not have provided enough information here in order to properly diagnose this (docker setup, kubernetes configuration, etc.), but I figured I may be misunderstanding something fundamental about this process, and that someone could be so kind as to enlighten me.
EDIT:
I found in the GKE documentation how to ensure that the Stackdriver logging is enabled for my cluster. Still no luck.
UPDATE (partial solution):
I set DEBUG = True in settings.py, which prompted the errors to start being logged in Stackdriver Logging and Error Reporting. I've gone ahead and done this for my canary environment, but it's less than ideal, since it exposes some of my backend code. Still not sure why this works for my other GCP project without running in debug mode.

Cannot run app pool as service account

I had a Python Flask website that ran fine when I ran the app pool as my own account. When I tried changing this to a service account (which should have permissions), I get the following error
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has
occurred.
Most likely causes: •IIS received the request; however, an internal
error occurred during the processing of the request. The root cause of
this error depends on which module handles the request and what was
happening in the worker process when this error occurred. •IIS was not
able to access the web.config file for the Web site or application.
This can occur if the NTFS permissions are set incorrectly. •IIS was
not able to process configuration for the Web site or application.
•The authenticated user does not have permission to use this DLL. •The
request is mapped to a managed handler but the .NET Extensibility
Feature is not installed.
Detailed Error Information: Module FastCgiModule
Notification ExecuteRequestHandler
Handler Python Flask
Error Code 0x80070542
Requested URL http://qatools:80/
Physical Path D:\PythonWebService\QATools
Logon Method Anonymous
Logon User Anonymous
If I change it back to run as my own account, it works. Any thoughts?
FYI after some tinkering, I changed the app pool to run with Managed Pipeline mode of "Classic" instead of "Integrated" and it worked.

Slow Flask on mod_wsgi on openshift

I have some performance issues with my Flask application on openshift.
There is a need to get some images from database and display them on the web page. And
for this taks, I have created a simple method :
#app.route('/getImage/')
def getImageFromUrl(url=None):
return make_response(getImageFromDb(request.args['url']));
There are maximum 10 images per page. And the problem is that this is slow.... veerry slow.
On my local machine, started with app.run() (even in debug mode) it is super fast, so I asume there is something in mod_wsgi.
Also there are these error messages in log files:
Exception KeyError: KeyError(140116433057760,) in <module 'threading' from '/usr/lib64/python2.6/threading.pyc'> ignored
and
[error] server reached MaxClients setting, consider raising the MaxClients setting
What is happening and what should I do to speed the things up?
Exception KeyError is caused by gevent I guess, should be more code in question :) To avoid it import gevent before all.
server reached MaxClients setting seems to be Apache error and should be investigated with logs and settings MaxClients and ServerLimt.
The KeyError is usually because you are using an old version of mod_wsgi. Use mod_wsgi 3.3 or later, which has changes to accommodate the changes which were made in Python that caused this.

Cant able to run the appliaction on appnegine SDK

I just tried to run the sample application(gustbook) on google app engine SDK. But it showing warning symbol for that apps.
I have re-insalled both python2.5 & GAE. Still app is not running.
Here is the Log:-
2011-12-07 11:15:51 Running command: "['C:\\Python25\\pythonw.exe', 'C:\\Program Files\\Google\\google_appengine\\dev_appserver.py', '--admin_console_server=', '--port=8080', u'C:\\Users\\Nijin\\Documents\\guestbook']"
WARNING 2011-12-07 03:16:00,286 urlfetch_stub.py:111] No ssl package found. urlfetch will not be able to validate SSL certificates.
WARNING 2011-12-07 03:16:02,512 rdbms_mysqldb.py:90] The rdbms API is not available because the MySQLdb library could not be loaded.
ERROR 2011-12-07 03:16:03,213 dev_appserver_main.py:632] <type 'exceptions.EOFError'>:
2011-12-07 11:16:03 (Process exited with code 1)
Screenshot: http://dl.dropbox.com/u/7384181/publish/sdk_error.JPG
I'm guessing you got invalid characters in one of your strings,
could you give us some code to work with and perhaps some working data?
I'm also guessing you're using the proper urlfetch function and not some home-brew socket solution because that wont work.
http://code.google.com/appengine/docs/python/urlfetch/fetchfunction.html
Try switching to Python 2.7, it's supported and should work better with most libs.
Are you using django-nonrel or something similar?

Categories

Resources