GAE Administration Console Custom Pages not showing up - python

I'm working on my first GAE project and I'm having some trouble getting custom pages to show up in the Admin Console. I'm following the Google Docs on it, but it doesn't seem to be working for me. I have a feeling it could have something to do with this note:
Note: Only custom pages defined by the default version will be shown
in the Admin Console.
but I'm not entirely sure what they mean (the default version of the app?).
The page URLs work fine if I visit them directly, but the links will not show in the Admin Console sidebar.
YAML:
application: namegenerator
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /css
static_dir: css
- url: /admin/.*
script: main.app
login: admin
- url: /.*
script: main.app
libraries:
- name: jinja2
version: latest
builtins:
- remote_api: on
admin_console:
pages:
- name: Manual DB Entry
url: /admin/db/add
- name: Clear DB
url: /admin/db/clear
Python routing:
app = webapp2.WSGIApplication([('/', MainHandler),
('/vote', SubmitVote),
('/clear_session', ClearUserSession),
('/admin/db/clear', ClearDatabase),
('/admin/db/add', ManualAddToDatabase)],
debug=True)
This is all being tested and run on my local machine, by the way. Thanks for any help.

Your code looks fine to me. Did you deploy your application? I think the admin pages will not be shown in your SDK.
By the way: An administrator can change which major deployed version of the application is default using Administration Console: https://appengine.google.com/

Related

Google App Engine Error at yaml_error

Following error as shown in screen-shot,occurs when i try to run my helloworld.py script in Google App engine from terminal.
#My Operating system:Ubuntu.14.#
And Here is my file app.yaml.
application: #My project Id.
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /static
static_dir: static
- url: /
static_files: static/index.html
upload: static/index\.html
secure: always
- url: /_ah/spi/.*
script: helloworld_api.app
libraries:
- name: endpoints
version: 1.0
The Problem is that i can't deploy my code on local machine.
Any helps would be Appreciated.Thanks :)
I had check Online Yaml parser and it shows its Valid too.
You're missing the libraries line, the endpoints library are actually interpreted as part of the handlers list, which is incorrect.
Should look like this:
...
- url: /_ah/spi/.*
script: helloworld_api.app
libraries:
- name: endpoints
version: 1.0

https - with apache for google app engine and python script is not working

I have Google App Engine and Python running on http://localhost, which is fine working. But for making it reliably working i need to add https, Google App Engine do not have it.
So i have been trying stunnel and apache to make https working. I tried following but its still not working.
NameVirtualHost example.stackoverflow.com:443
<VirtualHost example.stackoverflow.com:443>
SSLEngine on
SSLProxyEngine On
ProxyPreserveHost On
#ProxyRequests Off
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/stunnel/a.crt
SSLCertificateKeyFile /etc/stunnel/a.key
SSLCertificateChainFile /etc/stunnel/b.ca
ServerName localhost
ProxyPass / http://localhost
ProxyPassReverse / http://localhost
#ProxyPassReverseCookiePath /MYSITE/ /
CacheDisable *
</VirtualHost>
when a user visit: https://example.stackoverflow.com, basically his browser address get changed from https:// to http://example.stackoverflow.com and he is able to use the Google App Engine and Python instances.
But i need to have https for Google App Engine with my python. How can i resolve it please?
EDIT: secure is used but still not working
application: rtc
version: 6
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /html
static_dir: html
- url: /images
static_dir: images
- url: /js
static_dir: js
- url: /css
static_dir: css
- url: /.*
script: rtc.app
secure: always
inbound_services:
- channel_presence
libraries:
- name: jinja2
version: latest
Google App Engine does support HTTPS, you just need to sign up for it. It is not free, but it isn't too expensive either.
More information on the types of SSL provided is available at: SSL for a Custom Domain.
Also, if you want to automatically redirect users to the secure site, you can use the secure keyword in Google App Engine's app.yaml configuration file. See Secure URLs.

login: admin is simply ignored

I have this app.yaml:
application: xyz
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /static
static_dir: static
- url: /admin/.*
script: admin.app
login: admin
- url: /.*
script: main.app
libraries:
- name: webapp2
version: latest
- name: jinja2
version: latest
when I access /admin/, both the dev server and appengine display the contents without asking for authentication. What gives?
I've run into this before. Try clearing your cookies. Clearing the cookies also helps if you accidentally forgot to check "log in as administrator" when the dev server prompts you for the fake login info.

Google App Engine Handler not displaying content

Hi I'm trying to get my Google App Engine application running on local host but I'm getting issues when I try to run it.
This is the code I'm tryng to run:
# helloworld.py
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
#"Test" text is not displayed
self.response.write("Test")
app = webapp2.WSGIApplication([('/', MainHandler)],
debug=True)
#This line prints the content
print "This works fine"
When I run the dev server on localhost I get Code 200 as response but the handler doesn't seems to be executed properly.
Any idea?
Your code looks fine, just make sure your in your app.yaml you have the handlers correct. It should look something like this:
application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: .*
script: helloworld.app
libraries:
- name: webapp2
version: "2.5.2"
If you haven't done it yet, you should also complete the Getting Started tutorial.
I solved this issue. Using webapp2 library I have to add the folowing code to the *.yaml file:
libraries:
- name: webapp2
version: "2.5.2"

django non rel and google app engine: remote api issue

I am deploying a django-nonrel app on Google App Engine. The app deploys alright but I can't login to the remote shell.
This is my app.yaml file:
application: masnun
version: 1
runtime: python
api_version: 1
builtins:
- remote_api: on
inbound_services:
- warmup
handlers:
- url: /_ah/queue/deferred
script: djangoappengine/deferred/handler.py
login: admin
- url: /media/admin
static_dir: django/contrib/admin/media
expiration: '0'
- url: /.*
script: djangoappengine/main/main.py
But I am getting an error:
urllib2.URLError: <urlopen error HTTP Error 500: Internal Server Error
Couldn't reach remote_api handler at https://masnun.appspot.com/_ah/remote_api(/.*)?.
Make sure you've deployed your project and installed a remote_api handler in app.yaml.>
Please help me out!
Update: When using Python2.5, getting this error:
DEBUG:google.appengine.tools.appengine_rpc:Got http error, this is try #3
DEBUG:google.appengine.tools.appengine_rpc:Sending HTTPS request:
GET /_ah/remote_api(/.*)? HTTPS/1.1
Host: masnun.appspot.com
X-appcfg-api-version: 1
Content-type: application/octet-stream
User-agent: Google-remote_api/1.0 Linux/2.6.35-25-generic Python/2.5.5.final.0
Add this on app.yaml section handlers, first item:
handlers:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
and deploy again.
The problem is with
GET /_ah/remote_api(/.*)? HTTPS/1.1
If you notice, the URL contains invalid characters "(/.*)?" towards the end.
Assuming you are using django-nonrel, it is an easy fix. Open the file
djangoappengine/db/base.py
and change the line
self.remote_api_path = handler.url
to
self.remote_api_path = handler.url.split('(')[0] # remove '(/.*)' introduced in newer GAE
and that should take care of ensuring the URL is correct.
You can connect to the remote shell using
python manage.py remote shell
and only if you created your App Engine app with Google Accounts Authentication. But remote_api requires a deployed app and since your
python manage.py deploy
fails, the above error is normal.
What error do you get when you try to deploy?

Categories

Resources