-
Notifications
You must be signed in to change notification settings - Fork 302
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
ValueError: urls must start with a leading slash #128
Comments
It looks like there is an invalid url somewhere in your flask app. Are you using the existing example app, or importing it into your own app instance? If the latter, make sure all your url routes have a leading slash, e.g.: @app.route('foo/bar/')
def foobar():
pass would need to become: @app.route('/foo/bar/')
def foobar():
pass |
Just did a quick check and all the routes in the example |
@Thuruv I'll close this one if you've been able to isolate the problem, otherwise let me know, thanks! |
Hi @christabor , I run into the same error. It might be an error that arise from the platform, as I am using MS Windows. I get the same traceback as @Thuruv and find that when I put in a print() before the error it is related to static files. I had a look at chart_builder.py line 50. Here you use static_url_path=STATIC_DIR. This might not trough an exception on UNIX based systems, but on Windows, the path starts with a letter (fx C:...). The static_url_path should probably just be static_url_path="/STATIC/" or something. When I correct like that, the error is gone. Kr |
@madslundgaard Thanks, I've re-opened it and will take a look! |
@madslundgaard does this work for you? I don't have a windows VM to test with at the moment. You can
|
Hi @christabor, |
For your correction, the normpath will only change slashes, not the file drive which will still be C:... I think |
Ok, I think I understand a bit more clearly. However, the But the issue of the drive letter and colon being prepended still remains. A different solution would be to regex match and then replace the first bit, e.g. Either way, it does feel a bit hackish, but there are no obvious workarounds that I can see. |
Hi, That assignment could just be left out, then it should default to /STATIC/, or if it need be another URL path /some/URL/path/ could be specified. |
Same problem here trying to run example app in windows 10 |
In line 149 of blueprints.py, self.static_url_path equals state.add_url_rule('/static' + '/<path:fi
view_func=self.send_st
endpoint='static') and now it works. |
I had the same problem, but it is working on windows 10 with VMWARE. I installed this project in Ubuntu |
this problem still exists. just updating |
same too |
+1 win10 python3.6... +1 win10 python 2.7.8 |
Sorry folks, I'll try to put some time into this over the weekend. |
same problem |
…le path, resulting in a 500 error in Windows. Closes #128.
Hello, I have tried all the possible approaches but still having the same issue. I am not getting where exactly I need to fix this issue. |
Hi, i tried some approaches as well, but indeed, the same error on windows 10 +python 3.9 here. |
Hello, I'm facing the same error too. Did anyone come across a solution? |
Does anyone have a solution for this yet? |
The fix for us atleast was dgtlmoon/changedetection.io@7e0f0d0#diff-fff535675c4953d2d9411ee893a00a3abcd2b966b698123616479e6cd3985015 basically remove the full path from |
Thank You so much, it works |
I had the same error with my odoo 11 project, windows 10 and python 3.7. There is a URL that doesn't start with a leading slash (/) in the routing map :
Simply replace the line your odoo code by this line :
Hopefully it works ! |
I know somewhere I made a mistake but downloading and running it plainly gave me this error. I can understand somewhere in the routing the error is but I can find it, Can you help?
Traceback (most recent call last): File "app.py", line 17, in <module> app.register_blueprint(charts) File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\flask\app.py", line 64, in wrapper_func return f(self, *args, **kwargs) File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\flask\app.py", line 951, in register_blueprint blueprint.register(self, options, first_registration) File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\flask\blueprints.py", line 151, in register endpoint='static') File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\flask\blueprints.py", line 76, in add_url_rule view_func, defaults=defaults, **options) File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\flask\app.py", line 64, in wrapper_func return f(self, *args, **kwargs) File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\flask\app.py", line 1043, in add_url_rule rule = self.url_rule_class(rule, methods=methods, **options) File "C:\Users\c_thv\AppData\Local\Continuum\Anaconda2\envs\coffeemug\lib\site-packages\werkzeug\routing.py", line 603, in __init__ raise ValueError('urls must start with a leading slash') ValueError: urls must start with a leading slash
The text was updated successfully, but these errors were encountered: