Python webapp2 serve static content -




our team migrated project gae aws. 1 component web application built on top of webapp2, framework easy integrate gae. kept webapp2 framework in aws too, minor changes make work.

the web application works fine in cloud, i'm trying find way run on local development machines too. when using gae environment easy task because google provides app engine launcher, tool simulates cloud environment well.

in aws continued making hacks in order start web application using app engine launcher, want discard it. so, modified python script , starts don't know how serve static content. static files (css, js) added html templates link rel="stylesheet" type="text/css" href="{{statics_bucket}}/statics/css/shared.css"/, {{statics_bucket}} environment variable points specific amazon s3 bucket per environment. of course, doesn't work on localhost because nobody serving static content on http://localhost:8080/statics/css/shared.css example. google app engine launcher had feature , did hard job.

could point out way achieve goal?

i managed achieve goal following script:

import os.path import application  paste import httpserver paste.cascade import cascade paste.urlparser import staticurlparser  def main():     web_client = application.application     here = os.path.dirname(os.path.abspath(__file__))     static_app = staticurlparser(here)      app = cascade([web_client, static_app])     httpserver.serve(app, host='localhost', port='8080')  if __name__ == '__main__':     main() 

the script starts cloud application , component serves static files, both on same port inside same server.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -