python - When setting up app.yaml url handler, how to format url to script? -
i'm not sure how set url script handler within app.yaml. i've tried following docs (https://cloud.google.com/appengine/docs/python/config/cron) on setting cron job, crons failing in gae. getting error: \myproject\app.yaml: threadsafe cannot enabled cgi handler: myprojectapp/dsprocess.aggregate
i think docs assume not using wsgi, use of wsgi somehow affecting how scripts accessed within application.
this project structure pertinent files:
myproject/ myproject/ (package project) urls.py (defers url handling myprojectapp.urls) myprojectapp/ (package actual app) urls.py dsprocess.py ( contains aggregate function cron should call) app.yaml cron.yaml main.py within app.yaml, i'm not sure how format url dsprocess.py's aggregate function:
app.yaml
handlers: - url: /aggdb script: myprojectapp/dsprocess.aggregate <-- unsure here should myprojectapp.dsprocess.aggregate instead? myprojectapp.dsprocess.aggregate.py? myprojectapp.dsprocess.aggregate.app?
i'm running python 2.7.9
cron.yaml
cron: - description: aggregates db url: /aggdb schedule: every 1 mins main.py
import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler() myprojectapp/dsprocess.py
def aggregate(): myproject/urls.py , myprojectapp/urls.py
i'm guessing don't need set url patterns within these aggdb/ url hit, since app.yaml register , listen url pattern me. correct?
nonetheless, here 2 urls.py:
myproject/urls.py
urlpatterns = patterns('', (r'^', include('myprojectapp.urls')), ) myprojectapp/urls.py
urlpatterns = patterns('', ... #don't need handle here, let app.yaml handle it? # (r'^aggdb/$', dsprocess.aggdstojson()), ) would me use of wsgi affect how access scripts? if so, how , why?
it's python path, use dots not slashes.
but there nothing special cron urls: same other urls in project, , follow same rules. if want handled django, don't need add specific entry in app.yaml @ all, let use existing mapping rest of django urls.
Comments
Post a Comment