Onks
Tobi
Prince Raj
How I can learn starting basic of pythan
Prince Raj
Anyone can assist me for that
Artem
File "manage.py", line 22, in <module>
main()
File "manage.py", line 13, in main
raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
It is error when i run python3 manage.py runserver
What I should do?
Mirco
Mirco
and install Django inside it
Mirco
if you don't know what it is, go back studying Python first
Artem
Okey thank you, i know
Anonymous
gave up too soon, i guess
Cacio Lucas
Anyone know what could cause this error FileNotFoundError at /pdf/
[WinError 2] The system couldn't find the specified file?
Cacio Lucas
I'm generating a pdf with django-wkhtmltopdf, it works on my company computer, but when I commited and "git pulled" it in my computer, it raises this error
Cacio Lucas
If I change the html template file name, the error changes to TemplateDoesNotExists, so I think it is finding the html template at least
Mirco
As always, share the code
Cacio Lucas
oh, sure, sorry
Cacio Lucas
That's my view
class MyPDF(PDFTemplateView):
filename = 'my_pdf.pdf'
show_content_in_browser = True
template_name = 'os_pdf.html'
def get(self, request, *args, **kwargs):
response_class = self.response_class
try:
if self.request.GET.get('as', '') == 'html':
self.response_class = self.html_response_class
if 'id' in self.request.GET:
context = {'os':get_object_or_404(Evento,id=self.request.GET['id'])}
return super(PDFTemplateView, self).get(request,
*args, **kwargs)
finally:
# Remove self.response_class
self.response_class = response_class
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
if 'id' in self.request.GET:
context = {'os':Evento.objects.get(id=self.request.GET['id'])}
context['abs_path'] = pathlib.Path().absolute()
return context
This is my "structure" ...project\app\templates\os_pdf.html
And this is how I'm setting the path url(r'^pdf/$', v.MyPDF.as_view(), name='pdf')
KEV
Hi, Anyone know why this code still work ?, I had read redirect() function document, and know that it not contain context ! But when I to try this, my code still work :D
python
return redirect(f"wiki/{entry}", {
"content": util.get_entry(entry)
})
Anonymous
Hi anyone know django
Anonymous
Method Not allowed (Get) : /checkout/
Anonymous
Can anyone knows about ot
Anonymous
Getting 405 error after click checkout link
Sai Krupa Reddy
https://stackoverflow.com/questions/65677840/i-have-stored-the-data-in-json-format-in-js-file-i-want-to-bring-it-to-django-v
can anyone help me with this question?
Engnr
Hi someone to assist me on this, it is very slow on large amount of data
Deleted
how to convert <QuerySet [<Course: BME108_JUL2020>]> to 'BME108'? thanks
Shreehari
Tried bulk create?
Deleted
https://stackoverflow.com/questions/65681336/how-to-convert-queryset-course-bme108-jul2020-to-bme108-in-python
Deleted
the original is QuerySet , not string
Deleted
thanks anyway
Deleted
<class 'django.db.models.query.QuerySet'>
Deleted
objects.filter
Deleted
https://stackoverflow.com/questions/65681336/how-to-convert-queryset-course-bme108-jul2020-to-bme108-in-python
Deleted
code shown above in stackoverflow
Shaxzod )
objects.filter
edit Course model __str__ () function
def __str__(self):
return "{}".format(self.courseInfo.code)
Deleted
ok
The
Im hosting a django application in apache server, Im not able to switch on the ssh access, Is there any python or django command to turn on the ssh access?
The
I know nginx is better, but I need to host it in this apache as it was a static website and now transforming to dynamic web application using django
Ayushhhhhhh
Hello my nav bar isn't showing in my page
Ayushhhhhhh
Can anyone help
The
whats the error>
Ayushhhhhhh
<!-- Links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{% static '#' %}">Home</a>
</li>
</ul>
Ayushhhhhhh
this what i have done but in my page nav bar isnt showing
The
This is not the pl;ace where u hav the error.
The
but in href wht is {% static '# '%}
The
?
The
Ayushhhhhhh
it used to cinfigure static filesss
Ayushhhhhhh
configure*
The
The
https://getbootstrap.com/docs/4.0/components/navbar/
The
Try using this
The
Deleted
Deleted
The QuerySet value for an exact lookup must be limited to one result using slicing.
Gokula
is it possible to protect django python source code like builds in angular / react
âshîsh
If you want a general solution design (only approach to solution) then I can give. but if you want that I should done it completely from stretch then it's like a deal 😉 so you have to pay the developer to design your entire Solution.
Chandan
Can anyone help me with how to add restart server in django admin
goku
Can anyone tell how can I get id of college in a post request without asking college for it?
goku
Or how can I get id of college in post request from url?
âshîsh
Can anyone help me with how to add restart server in django admin
Create a boolean model form & attach it to admin.py
Then run script to check the form field if it's True or not.
If it gets true then run the python script having command
python manage.py startserver
That's a basic approach
You can find even more better ideas once you work on it.
Lucid
How can I apply the for loop with if else rules on fetched data of data base
Lucid
Like I am getting the error INTFIELD and int conversion
Lucid
For the grading engine in django
Lucid
I tried to search for it but couldn't help as I don't know much about data base or webdev I'm totally new init
Lucid
Okay I try Thanks alot
âshîsh
goku
âshîsh
âshîsh
Refer CRUD django
goku
Can't I get id from dynamic url and in view I will add it in post request
âshîsh
goku
I am not getting your point
Like there is an user in college who want to add same data in database we have multiple colleges so I want to know he(user) is from which college through his post request or if there is any other way.As the data I am adding in database wants a college_id as a foreign key
goku
I can't use session as I am creating a rest api for an app
goku
If anyone can help or suggest an article thanks in advance
thenils
Guys anyone can help how to register templatetag directory in settings.py file
Mirco