Anonymous
Are the templates written in html files or python files
Anonymous
Pls guys i need ur help
Anonymous
I've tried all the solutions but its still not working
Guillermo
Are the templates written in html files or python files
Templates are writen un the django template language, it is html with some flow control tags. Check out the docs
Anonymous
It gives me the template does not exist error
Guillermo
It gives me the template does not exist error
Show me the code where you are rendering the template
Anonymous
Oh OK
Anonymous
from django.shortcuts import render #from .models import Question def index(request): return render (request, 'index.html') # latest_question_list = Question.objects.order_by('-pub_date')[:5] # context = { # 'latest_question_list': latest_question_list, # } # return render(request, 'polls/index.html', context) #def detail(request, question_id) # question = get_object_or_404(Question, pk=question_id) # return render(request, 'polls/detail.html', {'question': question}) #def results(request, question_id): # response = "You.re looking at the results of question %s." # return HttpResponse(response % question_id) def vote(request, question_id): # return HttpResponse("You,re voting on question %s." % question_id)
Guillermo
So, do you have one of this routes on your project: templates/polls/index.html or polls/templates/polls/index.html?
Anonymous
Yes why did u ask tho
Guillermo
Which one?
Anonymous
Like where sorry I don't understand
Anonymous
Is it I'm y settings.py
Anonymous
My**
Guillermo
In which one of the routes do you have your templates? On a templates directory at the same level of the manage.py or inside you app? If its the first you may need to adjust your settings before django find the templates
Anonymous
Oh OK, so how can I adjust my settings
Anonymous
And I'm using the latest version tho
Guillermo
Locate the TEMPLATES variable un the settings and add this below backend
Guillermo
'DIRS': [ os.path.join(BASE_DIR, 'templates'),]
Anonymous
Ive tried it, it still gave the same erro
Guillermo
In the error Django should tell you all the dirs where it searched for the template. Show me that if you can
Anonymous
Shit my laptop battery is down tho
Anonymous
Like I've gone on the internet, I've checked stack overflow and the rest and ive tried their solutions but it still gives me the same error. I'm just confused
Anonymous
But the file where I write the template is it a python file or HTML file
Guillermo
Dont know what else to say. Maybe double check for typos
Guillermo
Its mostly html
Anonymous
Anonymous
Its mostly html
That means it won't end with py. Like index.html.py
Anonymous
It'll just be index.html
Guillermo
Yes
Guillermo
Only .html
Anonymous
Ok thanks tho. I will check for typos maybe the error is from me
Guillermo
Ok thanks tho. I will check for typos maybe the error is from me
Ok. If you solve it and have time, please comment here
Anonymous
Oh OK I will
Anonymous
Oh OK I will
Plz edit ur return , return render(request, 'polls/index.html')
diproger
Hello everybody
No One
Hloo9
diproger
if i install pyhton2.7, should i install pip too?
diproger
Stay away from 2.7 it expired
i am adding some features to deployed django project, this is required to use 2.7 . I need to build it locally on my windows 10, but i am facing a lot of problems
Neo
can anybody tell me how to get text from {{ form.fieldname.label_tag }}
Neo
currently i am getting: <lable for ="Field name:" class="form-control" required id="id_field_name" />First name:</label>
Neo
I only want to get the text "First name"
Neo
any refererance will be helpfull
Neo
this doesnt work?
if i use this in alert() it gives
inchidi
this
this code {{ form.fieldname.label_tag }} rendered to this <lable for ="Field name:" class="form-control" required id="id_field_name" />First name:</label> ?
Neo
yes
inchidi
oh yeah you are correct
diproger
i think using python2.7 gonna give you more problems
if i build a local project from existing one, What can you suggest me to do, i mean exact steps
inchidi
yes
how about {{ form.fieldname.label }} ?
inchidi
if i build a local project from existing one, What can you suggest me to do, i mean exact steps
mind to elaborate what you mean by "build a local proect from existing one" ?
Вадим
Hi, guys. I use foreign key for two models. When I delete first model, second model delete too. Can I stop the delete second model?
inchidi
Anonymous
Are there any developer group who work on django?
diproger
so you need to build and deploy your web app locally?
The project has been already deployed, I need to build it locally on my windows 10. I need to add some features. This project was deployed 1 year ago.
inchidi
yes running locally
oh, so you never work with django before?
Вадим
make sure you dont pass models.CASCADE to on_delete parameter of the ForeignKey field
Thanks. but should I not pass on_delete at all, or should I transfer something else instead of models.CASCADE?
diproger
Thanks. but should I not pass on_delete at all, or should I transfer something else instead of models.CASCADE?
so can you tell me any kind of methods to run it locally taking the code from source on the server?
inchidi
exactly
then follow this tutorial, if you already running python manage.py runserver then you already running it
inchidi
Thanks. but should I not pass on_delete at all, or should I transfer something else instead of models.CASCADE?
oh on_delete required, you have 2 choice then, set foreign key to NULL or do nothing with the fk value when your related data deleted?
inchidi
then follow this tutorial, if you already running python manage.py runserver then you already running it
@Diamond_Proger actually since what you want to do is edit the project, you will need to complete the tutorial if you want your life easier
Вадим
Thanks
Михаил
Hey guys, suggest please a solution to integrate receiving telegram group messages into django project? There two kinds of API which one to choose? One of them asking to enter mobile phone code on launch, how do I integrate this into django admin?
Luke
How do I fix a template does not exist error?
Luke
The template is located in the folder