Forums

Home - Page not found (404)

When typing the url name of my website (www.example.com), it does not take me to the index page, instead it will be redirected to www.example.com/defaultsite. And as far as I know I didn't create a page with the name "defaultsite"

This is what I am getting for an Error message :

Using the URLconf defined in electro.urls, Django tried these URL patterns, in this order:

admin/

[name='index']

about/ [name='about']

whyus/ [name='whyus']

request_manpower/ [name='request_manpower']

login/ [name='login']

employment/ [name='employment']

policies/ [name='policies']

The current path, defaultsite, didn't match any of these.


And this is how my urls.py looks like:

from django.urls import path

from . import views

urlpatterns = [

    path('', views.index, name='index'),

    path('about/', views.about, name='about'),

    path('whyus/', views.whyus, name='whyus'),

    path('request_manpower/', views.request_manpower, name='request_manpower'),

    path('employment/', views.employment, name='employment'),

    path('policies/', views.policies, name='policies'),

]

On my local machine works great, but not on pythonanywhere.com's server So, what am I doing wrong ?

Thank you in advance for any help !!!

[edit by admin: formatting]

Please, Can anyone Help !!!!! other links to the site are working well except the home page or when you type domain name of the site. The message i get is the Error Message described above.

Thank you !

Thank you for the big support. I figured out myself ! Everything is working well.

Excellent, glad you worked it out. What turned out to be the problem?

Hello electrostaffing.

Please how did you solve the problem? I'm in the same situation right now.

Visit to my website lands on the error page.

How do I configure the system to serve my index page first?

path(' ', views.index, name='index'),

thanks.

Hello Giles.

Are you including that urls file into the main urls for your web app?

Hi Glenn. Yes I'm.

From the error page, I can link to other pages too.

In the url.py file for my app, the pattern is namespaced like this:

app_name = "ural"

urlpatterns = [ path(' ', views.index, name='index'),]

In the browser, my index.html file has URL:

Https://www.me.com/Ural/

The problem is that I want to hit my index view function using the following URL:

Https://www.me.com

Please you can take a look at my code.

Lol. Thanks a lot Glenn.

Thank you for mentioning the "main urls for your webapp" in particular.

I just figured. Quite trivial though.

"Basic Request - Response cycle."

main site url configuration

urlpatterns = [ path('blog ', include('blog.urls')),

path(' ', include('ural.urls')),

path(' polls', include('polls.urls')),

path('admin/', admin.site.urls),

]

ural-app url confiiguration

app_name = "ural" urlpatterns = [

path('', views.index, name='index'),

path('about/', views.about, name='about'),

]

From the above,

https://www.me.com (base url)

will hit the ural index function/class view returning the webapp's default index.html page.

Thank you.

OK -- glad to hear you worked it out!