page index.html

86 views
Skip to first unread message

REMY TOUITOU

unread,
Aug 18, 2022, 4:26:31 PM8/18/22
to Django users
Hello , i tried to mke appear the page index.html in a django application in visual code , but i just obtained the  first page of the django site.
Someone could give  the right procedure to obtain thie page index.html?

hajar Benjat

unread,
Aug 18, 2022, 5:07:29 PM8/18/22
to django...@googlegroups.com
did you make it right (what about the urls.py and views.py )

 width=Sans virus.www.avast.com

hajar Benjat

unread,
Aug 18, 2022, 5:17:12 PM8/18/22
to django...@googlegroups.com
for example this is your project name 'firstproject' and this is your app name 'firstapp' in your template you will create a html page named 'index.html' in your 'firstapp' views.py you need to create a function for example : 
 def index(request):
    return render(request, 'index.html')

in your 'firstapp' urls.py you need something like this 
urlpatterns = [
     path('',views.index,name="index"),
]

and then in your 'firstproject' urls.py you need this 
from django.urls import path,include
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('firstapp.urls')),
]
--

HAJAR BENJAT

- Specialized Master in Information Systems Engineering

At CADI AYYAD UNIVERSITY FSSM Marrakech

- Computer Science Teacher 

P: +212698608188                   

E: hajar....@edu.uca.ma

LinkedIn: https://www.linkedin.com/in/hajar-benjat-a92132106

subin

unread,
Aug 18, 2022, 7:03:03 PM8/18/22
to django...@googlegroups.com
Sorry it took me so long to get back to you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMcj6Wf3evMhypW%3DOChVi-nUXoDQRU%2BZB-AFLtyEfvh1JJVh6Q%40mail.gmail.com.

subin

unread,
Aug 18, 2022, 7:03:35 PM8/18/22
to django...@googlegroups.com
Please let me know if that is okay.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

subin

unread,
Aug 18, 2022, 7:05:45 PM8/18/22
to django...@googlegroups.com
Thank you for your immediate response.

On Thu, Aug 18, 2022 at 9:26 PM REMY TOUITOU <touit...@gmail.com> wrote:
Hello , i tried to mke appear the page index.html in a django application in visual code , but i just obtained the  first page of the django site.
Someone could give  the right procedure to obtain thie page index.html?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

REMY TOUITOU

unread,
Aug 21, 2022, 12:23:47 PM8/21/22
to django...@googlegroups.com
Hello ,thank you for your help , 
it doesn't work yet
project.urls.py and the firstapp urls.py are two diffeérents pages ?
I don't arrive to make appear this two differents pages on isualcode , how can i do this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

user8234

unread,
Aug 21, 2022, 4:09:40 PM8/21/22
to django...@googlegroups.com
Hello touit...@gmail.com,. If you are using a framework web then a "static files" path should be defined or located in the root folder then maybe is not rendering *nothing*.

REMY TOUITOU

unread,
Aug 24, 2022, 5:45:23 AM8/24/22
to django...@googlegroups.com
hello  , i have a question , i can't make the server running , when i do the command  py manage;py runserver , it gives a lot of error in differents files , before the server was running well;
i use visual studio code and conda ;
thanks you 
remy

Le jeu. 18 août 2022 à 23:06, hajar Benjat <hajar...@gmail.com> a écrit :
--

Asif Ahmed Khan

unread,
Aug 24, 2022, 8:12:23 AM8/24/22
to django...@googlegroups.com
What type of errors are you facing?
Can you send some screenshots?
or error details?



--
K. Asif Ahmed
System Manager
Maharashtra State Seeds Co. Ltd, Akola
http://www.mahabeej.com/

REMY TOUITOU

unread,
Aug 24, 2022, 8:56:12 AM8/24/22
to django...@googlegroups.com
ok , i will send this to you this evening
thanks you

ALBERT ASHABA AHEEBWA

unread,
Aug 24, 2022, 9:53:03 AM8/24/22
to django...@googlegroups.com
You need to share a screenshot for better help.
Though it is manage.py and not manage;py



Best Regards,

Albert Ashaba Aheebwa
+256 781 435857

Håkon Øyen

unread,
Aug 24, 2022, 9:53:25 AM8/24/22
to Django users
Try locating the first of the listed files. That's usually where the error is.

ahmed doudou

unread,
Aug 24, 2022, 9:53:42 AM8/24/22
to django...@googlegroups.com

Danish Nagori

unread,
Aug 24, 2022, 9:53:43 AM8/24/22
to django...@googlegroups.com
Hi
Dear I  think you run py manage; py runserver 
So please 
You run this command 
 py manage.py runserver 
This is write commnd 
Thanks 


REMY TOUITOU

unread,
Aug 25, 2022, 7:01:16 AM8/25/22
to django...@googlegroups.com
Hello here is the kind of error i have when i try to make the server run

Thanks you

Le mer. 24 août 2022 à 14:11, Asif Ahmed Khan <aasif...@gmail.com> a écrit :
thumbnail.jpg

ALBERT ASHABA AHEEBWA

unread,
Aug 25, 2022, 7:22:19 AM8/25/22
to django...@googlegroups.com
So what happens when you just run $python manage.py? Does it bring up a list of commands you can run? If not you have to activate your virtual environment properly if you are using any.
Or path to the virtual environment py script 



hajar Benjat

unread,
Aug 25, 2022, 8:27:40 AM8/25/22
to django...@googlegroups.com
Sorry Is there any space between runser ver??
 Or am I wrong!...
It must be "runserver"


ALBERT ASHABA AHEEBWA

unread,
Aug 25, 2022, 8:33:20 AM8/25/22
to django...@googlegroups.com
No. There is no space. It's just "runserver". One word 

REMY TOUITOU

unread,
Aug 26, 2022, 5:42:49 AM8/26/22
to django...@googlegroups.com
hello , when i try to make the server running , it is written:    commanderror:you must set settings.ALLOWED_hosts if debug is false
thanks you

ALBERT ASHABA AHEEBWA

unread,
Aug 26, 2022, 6:16:05 AM8/26/22
to django...@googlegroups.com
Hello, Make sure in your project folder settings.py file has DEBUG=True and ALLOWED_HOSTS=[].
set debug to true and allowed hosts to empty list.
And ensure no local server is running before you runserver again

hajar Benjat

unread,
Aug 26, 2022, 6:17:36 AM8/26/22
to django...@googlegroups.com
you have DEBUG=False in your project.settings.py and you need to edit allowed hosts that is required for security reasons,  

example : 
ALLOWED_HOSTS=[".example.com" , "127.0.0.1:8000","localhost:port"]  or ALLOWED_HOSTS=["*"]  for quick test but DON'T use '*' in production .



Reply all
Reply to author
Forward
0 new messages