Closed ghost closed 3 months ago
I think we can return a default 404 page if the category is somehow none (not possible) and the404 page can be used for the whole website to tackle this.
Hey did you want to build the 404 page? or send a request for 404 not found?
Hey did you want to build the 404 page? or send a request for 404 not found?
Precisely, we can come up with a 404 page, with a little graphics. Like what github does https://github.com/asda;skjcladbnvabdnv
would you like to assign this issue to me
would you like to assign this issue to me
Sure LMK if any help is reqd, ask here or on our server
Okay I will create the frontend for the not found page 404 but I need some basic knowledge about how you render different html files in base.html file
@MohitBansal321
@app.errorhandler(Exception) def exception_page(error): return render_template('error.html')
Add this one in the main.py and create the page error.html
Just a demo.
Okay that's flask thing. It's called Jinja if you want I can show.
On Fri, 17 Feb, 2023, 4:49 pm Mohit Bansal, @.***> wrote:
I need to display the all content of base.html Inside it {% block content %} {% endblock content %} I want to display the Not Found page in between
— Reply to this email directly, view it on GitHub https://github.com/developersIndia/saadhan/issues/38#issuecomment-1434499353, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASZ57AN44S4DZJHP52Q4VDDWX5NDTANCNFSM6AAAAAAUXOLCQU . You are receiving this because you commented.Message ID: @.***>
How about this ?
How about this ?
Yess
Okay that's flask thing. It's called Jinja if you want I can show. … On Fri, 17 Feb, 2023, 4:49 pm Mohit Bansal, @.> wrote: I need to display the all content of base.html Inside it {% block content %} {% endblock content %} I want to display the Not Found page in between — Reply to this email directly, view it on GitHub <#38 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASZ57AN44S4DZJHP52Q4VDDWX5NDTANCNFSM6AAAAAAUXOLCQU . You are receiving this because you commented.Message ID: @.>
Yes please
{% extends 'base.html' %} {% block content %}
add this to `{% extends 'base.html' %} {% block content %}
add this in error html file
I do the same already
I though how should i send when something is wrong or not found
@ansid0102
python3 -m venv venv
I install the python and i added the path of python and python script and turn off the Manage App Execution Aliases.
but It show the error
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Python is installed
I think maybe it's because of path not set bro.
I think maybe it's because of path not set bro.
Path is set too
I found this stackoverflow try once: Go to -> "start" and type "Manage App Execution Aliases". Go to it and turn off "Python"
I found this stackoverflow try once: Go to -> "start" and type "Manage App Execution Aliases". Go to it and turn off "Python"
I already did all the internet solutions
Ohh then I don't know bro. If anyone knows how to figure this out. Please help him out @MohitBansal321 .
@MohitBansal321 Here are few solutions. https://bobbyhadz.com/blog/python-was-not-found-run-without-arguments-to-install
The best one is to uninstall python, remove the path and res install it again.
You can also use pipenv to manage you python project. https://github.com/pypa/pipenv
Please let me know if you need any other help.
hello! regarding the fix ghost mentioned here, it handles the exception only when no parameter(s) is/are passed in /resources
. when i go to an undefined route something like /foobar
, flask throws error due to request made to an undefined path in the /templates/base.html
file.
here are the relevant lines from the error.
File "saadhan/templates/error.html", line 1, in top-level template code
{% extends 'base.html' %}
File "saadhan/templates/base.html", line 11, in top-level template code
<meta property="og:url" content="{{ url_for(request.endpoint, _external=True) }}" />
File "saadhan/venv/lib/python3.12/site-packages/flask/app.py", line 1978, in url_for
if endpoint[:1] == ".":
^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
edit:
replacing url_for(request.endpoint, _external=True)
with request.url
fixes the issue, but im not sure if there are any downsides of using request.url
.
can i make a pr now? here is the error page screenshot
I don't think there are any downsides of using request.url
.
What happened?
The application throws an error if no category is specified on the
/resources
endpoint.For instance, the
https://saadhan.developersindia.in/resources
will throw a 500 error.This is due to the fact that category is None in this case and no default is specified, essentially resulting in a
KeyError
.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct