Google App Engine: WSGI Handlers and URLs

I am new to GAE and I am building a webapp map application. I was wondering when you install handlers in your .yaml application and when you define them in your WSGI?

At first I thought that you only have one main main.py file that runs WSGIApplication, but I notice that you want to use the GAE authorization that you define in the handlers. So this means that you are running several WSGIApplications?

I read the documents "Requirement for login or administrator status", and it seems they have different applications for different roles.

Maybe something like this?

- general.py - login:
- user.py - login: required
- admin.py: - login: admin

But maybe it's bad that your WSGI URLs are spreading everywhere?

If I remember correctly, if you run django in GAE, do you point to a single py file and let the framework handle everything?

I don't want to use Django, but it was so interesting if anyone has any recommendations / recommendations on working with url / hanlders using webapp?

+6
python google-app-engine
source share
1 answer

Any way of URL routing is acceptable.

URL routing based on app.yaml
If you can easily structure your application to use the routing of app.yaml (and authorization), then it is worth a try: this will be less than the code that you will have to debug, test, and maintain.

Here is an example (from Google) with multiple entry points: http://google-app-engine-samples.googlecode.com/svn/trunk/gdata_feedfetcher/

Performance should be excellent with app.yaml authorization: your Python script does not need to be run to determine if the user is the site administrator.

one URL mapping table
If your application needs something other than basic routing and URL authorization, you may find that you have a relatively rare app.yaml application and use a larger URL mapping table.

For example, you want to display the page for all users, but additionally want the "login" link to appear in the system. This code (for a simple blog) uses this structure.

+9
source share

All Articles