I am trying to learn how to use Google Appengine with python, using PyCharm Pro as trial. In have installed the Cloud SDK and it is active as indicated by getting access to both admin page and the Hello World! page. I had to overcome cannot bind problem by changing the port using dev_appserver.py
After that when I try to run the app in python, I get the following lines
INFO 2017-05-16 03:23:13,314 sdk_update_checker.py:231] Checking for updates to the SDK.
INFO 2017-05-16 03:23:13,458 sdk_update_checker.py:259] The SDK is up to date.
INFO 2017-05-16 03:23:13,517 api_server.py:272] Starting API server at: http://localhost:51009
INFO 2017-05-16 03:23:13,520 dispatcher.py:205] Starting module "default" running at: http://127.0.0.1:9000
INFO 2017-05-16 03:23:13,522 admin_server.py:116] Starting admin server at: http://localhost:8000
and it stalls there, nothing else happens and I get no error messages. I tried taking all the code out of the app.py file and just put a simple print('hello') and still does the same. tried restarting and reinitializing the Cloud SDK as well as the whole computer and still the same.
I am using MacOS and python venv as interpreter with webapp2 installed.
I looked in this forum and in multiple others and didn't see this problem described any where.
Also worth mentioning that the firewall is off
Related
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.
System:
Windows 10 x64 (enterprise computer with some restrictions)
Apache 2.4 64-bit
Python 3.7.1 64-bit
mod_wsgi (built today from github using python setup.py install)
I am working on getting an Apache server with Python on a Windows machine and I have the server configured correctly in order to get the Hello World! example from mod_wsig documentation working.
If I simply launch C:\Apache24\bin\httpd.exe, this works and I see Hello World at http://localhost:5000/
Then I wanted to get it running as a service, so I call
httpd.exe -k install
In the ApacheMonitor I start the new Apache2.4 service but I get a failed to start error. In the Windows system event log it says Event ID: 7024 with a service specific error: Incorrect function.
When I run httpd.exe -k start -n "Apache2.4" -t it says Syntax OK
What I can't find is any more information about the service error. Nothing populates in the error.log file and I don't know where else to look, and I am asking for any further information on how to diagnose this.
Before I started configuring Apache to use mod_wsgi, launching the service was successful, so this happened after doing that, and I haven't configured anything else at this point.
Go to the Command Prompt move to the apache/bin folder and type
>httpd -t
This will give you more information about the error preventing Apache from start.
I was getting this error after updating my httpd.conf file. The problem was that my final xml tag in httpd.conf was unclosed </directory without the closing >.
This days I was facing the same situation, windows 10, apache24, django app, python3.8, failing to start as service, service events showing error 7024...
So, after a lot of struggling and research, I would like to add my solution even this is an old question.
The solution was to add two environment variables, no in httpd.conf, not in python code/conf but at SO level (windows > environment variables)
PYTHONHOME = c:\your\path\to\installed\python
PYTHONPATH = c:\your\path\to\installed\virtualenv
And magic! apache now works as service and the django app is always available on localhost
I'm getting the below error when trying to run the command heroku run python manage.py migrate from the terminal.
ECONNRESET: read ECONNRESET
I followed the link in the heroku docs to check if there was a firewall issue, but I had a successful telnet connection. I haven't been able to find any other examples of anyone running into this issue unless they are having a proxy/firewall issue but according to the telnet test it doesn't seem like I have a problem right?
I've also tried testing any other heroku run command I can think of and I get the same result.
After reading the logs it showed that there was an Error Code R13. I was able to follow this thread to get what I needed to be fixed but was unable to run anything that needs to actually be attached (like an interactive shell).
Tried filing something with Heroku support but they basically said that it's outside the scope of free support. Disappointing.
The problem is related with a proxy in your internet connection.
Try to connect to heroku by using another internet connection, for example your mobile phone tethering.
It worked for me.
The problem is as a result of your internet connection provider blocking Heroku server. Change the source or provider of your internet and you will be able to connect to the Heroku Django console.
I am trying to start a python app-engine project on localhost. I am in a Windows 8.1 machine (Python version 2.7). The project code is copied from here link. The server seems to start but the page wouldn't properly load due to some problem. Probably it can't reach the api server.
Here is a shot from firebug showing the failed request
What seems off to me is that in command prompt (I started the dev server from there) the API server is started at some random port other than the module port. But the webpage is trying to access the http://127.0.0.1:8000/_ah/api/static/proxy.html... page at the module port. I tried accessing it at the API server port it does open some page there. (I mean I tried opening http://127.0.0.1:1532/_ah/api/static/proxy.html... seperately) It returns some json I don't understand...
{app_id: dev~udatut-bs, rtok: '0'}
Command prompt log:
Here's the difference between the outputs in localhost and *.appspot.com
Should get this:
But stuck here:(check buttons are not loaded)
I finally found a solution here.
Steps for windows:
Goto your google appengine installation folder and then ./google/appengine/toots. (C:\Program Files (x86)\Google\google_appengine\google\appengine\tools) if you followed default installation instructions.
Open the file appengine_rpc.py and look for the line (towards the end of the file)
opener.add_handler(fancy_urllib.FancyProxyHandler())
and comment it out like
# opener.add_handler(fancy_urllib.FancyProxyHandler())
Close the app and restart it again.
When trying to deploy using the new Python GoogleAppEngine-1.9.19 in the form of the GAE launcher on Windows 7, I'm not asked to authenticate. Instead, I get a page for accepting GAE management, and then I'm running locally. Moreover, clicking the close box on the launcher does nothing and I have to kill it externally.
I don't understand the error messages or what to do. I don't have a file named old_run.py. I uninstalled 1.9.19 and reinstalled 1.9.18, and deploy works as always. Is 1.9.19 broken?
2015-04-15 11:27:47 Running command: "['C:\\Python27\\python.exe', '-u', 'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--oauth2', 'update', 'M:\\HP_Cdrive\\workspace\\glowscript']"
11:27 AM Application: glowscript; version: 1
11:27 AM Host: appengine.google.com
11:27 AM
Starting update of app: glowscript, version: 1
11:27 AM Getting current resource limits.
2015-04-15 11:27:50,838 WARNING old_run.py:88 This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=550516889912.apps.googleusercontent.com&access_type=offline
If your browser is on a different machine then exit and re-run
this application with the command-line parameter
--noauth_local_webserver
It's an issue with Google App Engine SDK, which doesn't allow the user authentication process to be completed, if local server is running.
Step 1. Stop the local server.
Step 2. Click on 'Deploy'
Step 3. You should get a message "The authentication flow has completed."
Step 4. Close the Window.
Step 5. Deploy again using Google App Engine. You should receive a message You
can close this window now.
you just have to shut down the server I use the google app engine luncher run and stop then deploy
Sorry about that - the tooling is in the process of changing. The docs should be updated shortly.
Try gcloud preview app deploy path-to/your.yaml --project myProjectID
You can deploy successfully in 1.9.19 by using command line.
appcfg.py update myapp/
Use an application-specific password instead of your regular account password.
In any case, you'll get a message that:
now the recommended way to log in is using OAuth2. See
https://developers.google.com/appengine/docs/python/tools/uploadinganapp#Python_
Password-less_login_with_OAuth2
If you are having problems with the redirection to localhost:8085, you can try to use wget from the server you're trying to authenticate, something like:
wget http://localhost:8085/?code=4/SOMELONGKEY#
After this you should be logged.
In my case, there was not version parameter in app.yaml file. When I add the parameter it has worked.
application: myappname
runtime: python27
api_version: 1
threadsafe: true
version: 1