I recently bought RealPython to learn about Python and web development. However, I came across a road block, which in my opinion is a Python configuration problem on my machine. Any help would be greatly appreciated.
So I have a flash document called app.py similar to RealPython github app.py
Unfortunately, I get this error when I try to run the application:
machine:flask-hello-world machine$ source env/bin/activate (env)machine:flask-hello-world machine$ python app.py Traceback (most recent call last): File "app.py", line 29, in <module> @app.route("/float/<float:value>") File "/Volumes/disk2/Home/Library/RealPython/flask-hello-world/env/lib/python2.7/site-packages/flask/app.py", line 1013, in decorator self.add_url_rule(rule, endpoint, f, **options) File "/Volumes/disk2/Home/Library/RealPython/flask-hello-world/env/lib/python2.7/site-packages/flask/app.py", line 62, in wrapper_func return f(self, *args, **kwargs) File "/Volumes/disk2/Home/Library/RealPython/flask-hello-world/env/lib/python2.7/site-packages/flask/app.py", line 984, in add_url_rule 'existing endpoint function: %s' % endpoint) AssertionError: View function mapping is overwriting an existing endpoint function: type
Beer freezing gives these requirements as for virtualenv env . Python 2.7 is what is installed.
Flask==0.10.1 Jinja2==2.7.3 MarkupSafe==0.23 Werkzeug==0.9.6 itsdangerous==0.24 wsgiref==0.1.2
The only way I was able to run the code was to change the def type. Do not do this, though ...
# dynamic route with an int type @app.route("/integer/<int:value>") def type(value): print value + 1 return "correct"
source share