Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static URL rule not being added on GAE with static_dir handler #81

Closed
sirn opened this issue Jul 7, 2010 · 2 comments
Closed

Static URL rule not being added on GAE with static_dir handler #81

sirn opened this issue Jul 7, 2010 · 2 comments

Comments

@sirn
Copy link

sirn commented Jul 7, 2010

When app.yaml has static_dir point to Flask application's static/ directory, os.path.exists will always return False and thus causing _PackageBoundObject.has_static_dir to return False making static URL rule not being added at initialization.

Example:

app.yaml

application: demo
version: 1
runtime: python
api_version: 1

handlers:
- url: /static
  static_dir: static

- url: /.*
  script: app.py

app.py

from google.appengine.ext.webapp.util import run_wsgi_app
from flask import Flask
app = Flask(__name__)

@app.route('/')
def demo():
    return str(app.has_static_folder)

def main():
    run_wsgi_app(app)

if __name__ == '__main__':
    main()

This will return False but will return True once I comment out the static handler. Current workaround is to add static rule myself, using app.add_url_rule(app.static_path + '/<path:filename>', endpoint='static') of sort. It would be nice of Flask detects GAE and add the static path anyway.

@mitsuhiko
Copy link
Contributor

The solution is probably to just register the rule anyways. Detecting GAE sounds abit fishy and would change behavior for a specific environment. Unless someone can figure out any reasonable ways to fix that.

@mitsuhiko
Copy link
Contributor

Always register URL rules. This closed by ed16ae2

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants