Hi Ryan,

I would recommend trying to solve the first problem and serving static
files locally.

At first glance I think the most straightforward ways to do that would be
to either:

- Use the Flask development server instead of gunicorn and leverage Flask's
integrated /static directory
https://flask.palletsprojects.com/en/1.1.x/tutorial/static/
- If you prefer to use gunicorn or you need more serving options, add
WhiteNoise middleware to your app; ideally, have your app detect whether
it's running in production or in development mode and conditionally add
WhiteNoise in development only: http://whitenoise.evans.io/en/stable/


On Fri, Nov 8, 2019 at 2:21 PM Ryan B <goo...@ryanb.org> wrote:

> Hi all! My Python 3 topic for the day is local development. How are you
> all doing it? Any tips?
>
> The two main ways seem to be a third party server, eg Flask or Gunicorn,
> or dev_appserver.py. I have both working, but each one has a fatal flaw
> that makes it basically unusable for me so far.
>
> When I run my app with eg gunicorn -b :8080 app:application - the way
> Google recommends
> <https://cloud.google.com/appengine/docs/standard/python3/testing-and-deploying-your-app#running_locally>
> - it works, but doesn't serve any assets from static file handlers in my
> app.yaml. This is widely reported on StackOverflow
> <https://stackoverflow.com/search?q=%5Bgoogle-app-engine%5D+%5Bpython-3.x%5D+static>
> and elsewhere. Responses are often some variation of, "why do you need
> static assets for dynamic requests?" The obvious reason is that pretty much
> all webapps use images, CSS, and/or JS, among other static files. They're
> generally not usable without those assets.
>
> When I run my app with  dev_appserver.py, it creates a new virtualenv and
> installs all of my dependencies from requirements.txt. This is nice, but
> also extremely slow for any nontrivial app. My current medium sized app has
> 155 packages, and even when they're all cached locally, installing them
> takes around 60s. I often switch between different apps and other stacks,
> so I can't often keep dev_appserver running for hours or days on end to
> avoid this. (I've filed this feature request for dev_appserver to reuse
> an existing virtualenv.
> <https://issuetracker.google.com/u/1/issues/144150446>)
>
> Let me know if you have any ideas!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/eff3cf33-3a7b-4cc4-8b8c-2a46b2c56c45%40googlegroups.com
> <https://groups.google.com/d/msgid/google-appengine/eff3cf33-3a7b-4cc4-8b8c-2a46b2c56c45%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CANtYgF%2BPRh3vU%3Dpp3708sRAFE8%2BYxC%3Dm%2BmC8oGVqHyLw3yKBhw%40mail.gmail.com.
  • [google-appengin... Ryan B
    • Re: [google... 'Andrew Gorcester' via Google App Engine
      • Re: [go... Ryan Barrett
        • Re:... 'Andrew Gorcester' via Google App Engine
        • Re:... Remko Tronçon
          • ... Ruby Tokantekai
            • ... 'Katayoon (Cloud Platform Support)' via Google App Engine
          • ... Ryan B
            • ... Ryan B
              • ... 'George (Cloud Platform Support)' via Google App Engine

Reply via email to