Google App Engine - This app has no instances deployed - python-2.7

App Instances:
App Versions:
app.yaml:
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /my_uri
script: path.to.my.script.script.app
I created a Python Flask app with Google App Engine. I initially ran into some issues, so I re-deployed the app. This created a new version. After doing so, I deleted the previously existing version which had one instance deployed. The currently deployed version has no instances deployed, as you can see in the image at the link above.
When I submit a request to my-app-ID.appspot.com/my_uri, I get a 404 error:
Error: Not Found
The requested URL /my_uri was not found on this server.
I believe this is related to my app not having an instance deployed. Is that correct? If so, how would I remedy this?
If not, what could be causing the 404 issue?
Thanks everyone!

As your error message indicates gcloud app browse makes a request for the / url to your app.
From Request handlers:
When App Engine receives a web request for your application, it calls
the handler script that corresponds to the URL, as described in the
application's [app.yaml][2] configuration file . The Python 2.7
runtime supports the WSGI standard and the CGI standard for
backwards compatibility. WSGI is preferred, and some features of
Python 2.7 do not work without it. The configuration of your
application's script handlers determines whether a request is
handled using WSGI or CGI.
But your app.yaml file does not contain a handler with a matching url pattern (as / doesn't match /my_uri), so GAE doesn't know which app script to launch for that request, so it'll return 404.
So the first thing you have to do is to add in app.yaml a handler with a url pattern that matches a / request.
You may want to go through the Getting Started with Flask on App Engine Standard Environment guide. In there the recommended handler would be:
handlers:
- url: /.*
script: main.app
The above alone won't necessarily make your app work, there's plenty of other things that can go wrong. You should get familiar with the app's log viewer as that's essential for debugging your app. See Understanding request log fields
But before you even go to deployment on GAE, learn how to run and test your app locally. See Using the Local Development Server

Related

API is not working in flutter_web(Enabled CORS)

I Made one POST API in Django rest framework. It working perfectly in Postman in also chrome and other browsers but it is not working in my flutter_web project. it is giving me XMLHttpRequest error. for enable CORS I had used python -m pip install django-cors-headers.
you can check my api from https://findweight.herokuapp.com/idealweight which takes raw data for example 5.
you can check my whole error from following image:- https://i.stack.imgur.com/Fx8Xp.png
Make sure that you have applied all the migrations properly on the backend.
If not then migrate it first by python manage.py migrate.
And restart your server again and see the logs by changing DEBUG = True,
So you can see what is the error (NOTE: Make sure you change DEBUG = False before going to production).
And also, check if you have set up CORS property properly on the backend.

In production Page not Found Error when trying to access Django /admin on deployed Heroku app

Friends -
I have a django app (build with cookiecutter) and I have it deployed on Heroku, following these steps here:
https://cookiecutter-django.readthedocs.io/en/latest/deployment-on-heroku.html
Everything works fine and I can also create instances in the database. Now, when I try to enter the admin-page with /admin I get an 404 Page not found error.
When deploying I had this error: (which I ignored)
remote: Invalid input of type: 'CacheKey'. Convert to a byte, string or number first.
remote: --> Continuing using default collectstatic.
I ignored this error because I everything was working. Now, could that be connected or am I just missing something here?
I assume I after deployment I should be able to login to the django admin section, or am I mistaken? I set my admin url in my .env file, but still, I get this problem. Locally everything runs perfectly....
Any help or hints are very much appreciated!

Deploying django on app engine 500 server error

I am trying to deploy completed web-app (runs locally) on the app engine. The app has no databases and the web page is static. My primary problem is that I try to deploy the app and I get a server error. I suspect that the issue lies with my app.yaml file but I cannot seem to fix it. Here is my yml file:
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /static
static_dir: personal/static/
- url: /.*
script: mysite.wsgi.application
The directory is organized so that the 'personal' is an installed app and static, templates etc. are inside the personal folder.
In settings file, make DEBUG=False for short time to just check what is error, then return it back to True

django html5 cache in django 1.7

I've got some problems implementing 3rd party django package django-html5-appcache.
Documentation especify that migrate command must be executed, but when i execute command:
python manage.py migrate html5_appcache
Outputs:
"No migrations to apply"
However I decided to complete installation steps. but testing it maniffest file appears to be empty (according to docs, urls suppose to autodiscover):
CACHE MANIFEST
# version: $0$
# date: $-$
NETWORK:
*
And Chrome Console Outputs:
Creating Application Cache with manifest http://127.0.0.1:8000/manifest.appcache
127.0.0.1/:1 Application Cache Checking event
127.0.0.1/:1 Application Cache Downloading event
127.0.0.1/:1 Application Cache Progress event (0 of 0)
127.0.0.1/:1 Application Cache Cached event
Im using Django 1.7
Any body has expirience with this django package?
I suspect that you're supposed to put the following code in your urls.py to get autodiscover.
Enable appcache discovery by adding the lines below in urls.py:
import html5_appcache
html5_appcache.autodiscover()
(Source: documentation here: https://django-html5-appcache.readthedocs.org/en/latest/installation.html)
Also, python manage.py migrate commands are used to alter the DB structure and should not affect your urls.py.

Heroku Server 500 error on particular page

Just deployed a Django app on Heroku. Everything works except for one page of my site which creates a Server 500 error (even though it works fine on my local development server).
The page raising the error doesn't do anything unusual. It makes some database calls, renders some forms, implements JQuery, etc. Any clue what this could be or how I can debug it?
Also, I thought this might be a data issue since my data in Dev doesn't match my data in production, but I checked and this doesn't seem to be the cause.
enable DEBUG=TRUE in your django settings.py file or type in console heroku logs --app your_app to get heroku server logs.
This was because I didn't include a runtime.txt telling Heroku to use Python 3 instead of 2 which subsequently raised an error in one of my views where I called super() with no args.