Django default root page stops working when I add my app to urlpatterns in urls.py












0















I am new to Django and only followed one tutorial on Visual Studio which worked fine.
Now I was trying to create another project on PyCharm and am facing the below problem.



the default Django template sets up fine in Pycharm and I see the default root/landing page when I run the project.



but the moment I add a url for my app in urls.py the default Django page stops working, although both the admin url and myapp urls work fine.



my Urlspatterns is provided below:



urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^myapp/', include('myapp.urls', namespace='myapp')),
]


the moment I remove the line the default Django landing page starts working again.
I have tried searching online but was unable to find an explanation. Posting it here because I would really like to know why this happens.



enter image description here










share|improve this question

























  • Have you tried running it in debug mode so you can get the traceback? It would help to know what the error is you're getting.

    – Mihai Chelaru
    Nov 16 '18 at 2:04











  • added screenshot to the above question

    – nebula_007
    Nov 16 '18 at 6:30











  • That screenshot tells you what the problem is. You need to define a URL pattern for the homepage of the site. Right now you could go to 'admin/' or 'myapp/' but not ''. Add a URL pattern for that that points to a view and see if that fixes it.

    – Mihai Chelaru
    Nov 16 '18 at 13:08











  • hi @MihaiChelaru, my question is, when I remove the 'myapp' url definition, then the root '/' url works, even though there is no definition available except for 'admin/' in the urlpatterns generated by the project. it's only when I add a URL in addition to the default 'admin' when the default landing page stops working.

    – nebula_007
    Nov 17 '18 at 0:28













  • The answer to that is on the page itself. Just look at the screenshot in the answer below: "You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs. When you added that URL pattern in there the default Django homepage disappears. Add your own homepage as I described, since I presume you want to do that anyways. I'm not sure what the problem is here.

    – Mihai Chelaru
    Nov 17 '18 at 0:30
















0















I am new to Django and only followed one tutorial on Visual Studio which worked fine.
Now I was trying to create another project on PyCharm and am facing the below problem.



the default Django template sets up fine in Pycharm and I see the default root/landing page when I run the project.



but the moment I add a url for my app in urls.py the default Django page stops working, although both the admin url and myapp urls work fine.



my Urlspatterns is provided below:



urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^myapp/', include('myapp.urls', namespace='myapp')),
]


the moment I remove the line the default Django landing page starts working again.
I have tried searching online but was unable to find an explanation. Posting it here because I would really like to know why this happens.



enter image description here










share|improve this question

























  • Have you tried running it in debug mode so you can get the traceback? It would help to know what the error is you're getting.

    – Mihai Chelaru
    Nov 16 '18 at 2:04











  • added screenshot to the above question

    – nebula_007
    Nov 16 '18 at 6:30











  • That screenshot tells you what the problem is. You need to define a URL pattern for the homepage of the site. Right now you could go to 'admin/' or 'myapp/' but not ''. Add a URL pattern for that that points to a view and see if that fixes it.

    – Mihai Chelaru
    Nov 16 '18 at 13:08











  • hi @MihaiChelaru, my question is, when I remove the 'myapp' url definition, then the root '/' url works, even though there is no definition available except for 'admin/' in the urlpatterns generated by the project. it's only when I add a URL in addition to the default 'admin' when the default landing page stops working.

    – nebula_007
    Nov 17 '18 at 0:28













  • The answer to that is on the page itself. Just look at the screenshot in the answer below: "You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs. When you added that URL pattern in there the default Django homepage disappears. Add your own homepage as I described, since I presume you want to do that anyways. I'm not sure what the problem is here.

    – Mihai Chelaru
    Nov 17 '18 at 0:30














0












0








0








I am new to Django and only followed one tutorial on Visual Studio which worked fine.
Now I was trying to create another project on PyCharm and am facing the below problem.



the default Django template sets up fine in Pycharm and I see the default root/landing page when I run the project.



but the moment I add a url for my app in urls.py the default Django page stops working, although both the admin url and myapp urls work fine.



my Urlspatterns is provided below:



urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^myapp/', include('myapp.urls', namespace='myapp')),
]


the moment I remove the line the default Django landing page starts working again.
I have tried searching online but was unable to find an explanation. Posting it here because I would really like to know why this happens.



enter image description here










share|improve this question
















I am new to Django and only followed one tutorial on Visual Studio which worked fine.
Now I was trying to create another project on PyCharm and am facing the below problem.



the default Django template sets up fine in Pycharm and I see the default root/landing page when I run the project.



but the moment I add a url for my app in urls.py the default Django page stops working, although both the admin url and myapp urls work fine.



my Urlspatterns is provided below:



urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^myapp/', include('myapp.urls', namespace='myapp')),
]


the moment I remove the line the default Django landing page starts working again.
I have tried searching online but was unable to find an explanation. Posting it here because I would really like to know why this happens.



enter image description here







django






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 6:30







nebula_007

















asked Nov 16 '18 at 2:02









nebula_007nebula_007

113




113













  • Have you tried running it in debug mode so you can get the traceback? It would help to know what the error is you're getting.

    – Mihai Chelaru
    Nov 16 '18 at 2:04











  • added screenshot to the above question

    – nebula_007
    Nov 16 '18 at 6:30











  • That screenshot tells you what the problem is. You need to define a URL pattern for the homepage of the site. Right now you could go to 'admin/' or 'myapp/' but not ''. Add a URL pattern for that that points to a view and see if that fixes it.

    – Mihai Chelaru
    Nov 16 '18 at 13:08











  • hi @MihaiChelaru, my question is, when I remove the 'myapp' url definition, then the root '/' url works, even though there is no definition available except for 'admin/' in the urlpatterns generated by the project. it's only when I add a URL in addition to the default 'admin' when the default landing page stops working.

    – nebula_007
    Nov 17 '18 at 0:28













  • The answer to that is on the page itself. Just look at the screenshot in the answer below: "You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs. When you added that URL pattern in there the default Django homepage disappears. Add your own homepage as I described, since I presume you want to do that anyways. I'm not sure what the problem is here.

    – Mihai Chelaru
    Nov 17 '18 at 0:30



















  • Have you tried running it in debug mode so you can get the traceback? It would help to know what the error is you're getting.

    – Mihai Chelaru
    Nov 16 '18 at 2:04











  • added screenshot to the above question

    – nebula_007
    Nov 16 '18 at 6:30











  • That screenshot tells you what the problem is. You need to define a URL pattern for the homepage of the site. Right now you could go to 'admin/' or 'myapp/' but not ''. Add a URL pattern for that that points to a view and see if that fixes it.

    – Mihai Chelaru
    Nov 16 '18 at 13:08











  • hi @MihaiChelaru, my question is, when I remove the 'myapp' url definition, then the root '/' url works, even though there is no definition available except for 'admin/' in the urlpatterns generated by the project. it's only when I add a URL in addition to the default 'admin' when the default landing page stops working.

    – nebula_007
    Nov 17 '18 at 0:28













  • The answer to that is on the page itself. Just look at the screenshot in the answer below: "You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs. When you added that URL pattern in there the default Django homepage disappears. Add your own homepage as I described, since I presume you want to do that anyways. I'm not sure what the problem is here.

    – Mihai Chelaru
    Nov 17 '18 at 0:30

















Have you tried running it in debug mode so you can get the traceback? It would help to know what the error is you're getting.

– Mihai Chelaru
Nov 16 '18 at 2:04





Have you tried running it in debug mode so you can get the traceback? It would help to know what the error is you're getting.

– Mihai Chelaru
Nov 16 '18 at 2:04













added screenshot to the above question

– nebula_007
Nov 16 '18 at 6:30





added screenshot to the above question

– nebula_007
Nov 16 '18 at 6:30













That screenshot tells you what the problem is. You need to define a URL pattern for the homepage of the site. Right now you could go to 'admin/' or 'myapp/' but not ''. Add a URL pattern for that that points to a view and see if that fixes it.

– Mihai Chelaru
Nov 16 '18 at 13:08





That screenshot tells you what the problem is. You need to define a URL pattern for the homepage of the site. Right now you could go to 'admin/' or 'myapp/' but not ''. Add a URL pattern for that that points to a view and see if that fixes it.

– Mihai Chelaru
Nov 16 '18 at 13:08













hi @MihaiChelaru, my question is, when I remove the 'myapp' url definition, then the root '/' url works, even though there is no definition available except for 'admin/' in the urlpatterns generated by the project. it's only when I add a URL in addition to the default 'admin' when the default landing page stops working.

– nebula_007
Nov 17 '18 at 0:28







hi @MihaiChelaru, my question is, when I remove the 'myapp' url definition, then the root '/' url works, even though there is no definition available except for 'admin/' in the urlpatterns generated by the project. it's only when I add a URL in addition to the default 'admin' when the default landing page stops working.

– nebula_007
Nov 17 '18 at 0:28















The answer to that is on the page itself. Just look at the screenshot in the answer below: "You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs. When you added that URL pattern in there the default Django homepage disappears. Add your own homepage as I described, since I presume you want to do that anyways. I'm not sure what the problem is here.

– Mihai Chelaru
Nov 17 '18 at 0:30





The answer to that is on the page itself. Just look at the screenshot in the answer below: "You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs. When you added that URL pattern in there the default Django homepage disappears. Add your own homepage as I described, since I presume you want to do that anyways. I'm not sure what the problem is here.

– Mihai Chelaru
Nov 17 '18 at 0:30












1 Answer
1






active

oldest

votes


















0














enter image description here



This page is intended only to show that django is working properly. As soon as you add any url it is disabled.






share|improve this answer
























  • I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

    – nebula_007
    Nov 16 '18 at 6:32











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330430%2fdjango-default-root-page-stops-working-when-i-add-my-app-to-urlpatterns-in-urls%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














enter image description here



This page is intended only to show that django is working properly. As soon as you add any url it is disabled.






share|improve this answer
























  • I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

    – nebula_007
    Nov 16 '18 at 6:32
















0














enter image description here



This page is intended only to show that django is working properly. As soon as you add any url it is disabled.






share|improve this answer
























  • I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

    – nebula_007
    Nov 16 '18 at 6:32














0












0








0







enter image description here



This page is intended only to show that django is working properly. As soon as you add any url it is disabled.






share|improve this answer













enter image description here



This page is intended only to show that django is working properly. As soon as you add any url it is disabled.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 2:17









Helio Meira LinsHelio Meira Lins

264




264













  • I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

    – nebula_007
    Nov 16 '18 at 6:32



















  • I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

    – nebula_007
    Nov 16 '18 at 6:32

















I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

– nebula_007
Nov 16 '18 at 6:32





I would expect the root / default page to stay unless specifically overridden in the urls file, otherwise it ends up displaying an error (image now added)

– nebula_007
Nov 16 '18 at 6:32


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330430%2fdjango-default-root-page-stops-working-when-i-add-my-app-to-urlpatterns-in-urls%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)