Vikas
Hey everyone I am new in python django but not understand django projects in my company so how i learn it and master it please guide me
Syed
Ruzan
Drago
I have a problem with robots txt. The test site runs successfully on localhost, but now I've deployed it, and the
/robots.txt
section doesn't work.
Page not found (404)
Request Method: GET
Request URL: http://username.pythonanywhere.com/robots.txt/
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
polls/
admin/
robots.txt
The current path, robots.txt/, didn’t match any of these.
Here is the
urls.py
:
from django.contrib import admin
from django.urls import include, path
from django.views.generic.base import TemplateView
from robots.views import robots_txt
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
path("robots.txt", robots_txt),
]
and
robots/views.py
:
from django.views.decorators.http import require_GET
from django.http import HttpResponse
@require_GET
def robots_txt(request):
lines = [
"User-Agent: Googlebot",
"Disallow: /polls/",
]
return HttpResponse("\n".join(lines), content_type="text/plain")
Sayidbek
Hello guys, I created a model which should create random number for each new member but it's giving random number to all.
Sayidbek
from django.db import models
def get_random_number():
import random
random_number = random.randint(100, 999)
return random_number
class ClubMember(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
country = models.CharField(max_length=50)
email = models.EmailField()
age = models.IntegerField()
joined_date = models.DateTimeField(auto_now_add=True)
secret_number = get_random_number()
def str(self):
return f'{self.first_name} {self.last_name}'
Sayidbek
RIP
When I debug in vscode with django app, if the auto save is disable , each time I edit views.py or forms.py, the develop server restart cost almost 10 secondes. Is it normal? Can I make it faster , I change a lot and very frequency,
RIP
but If only edit the templages html file , it display the change instantly.
Maxim
Abhishek
Is there any other ORM connector available for django except djongo?
Sayidbek
Raj
How to activate links from one page to another in django
Sophia
Reverse for ‘placeOrder’ with arguments ‘(”,)’ not found. 1 pattern(s) tried: [‘placeOrder/(?P[^/]+)/$’]
how to solve this error kindly help pls
Ceby007
Why this error?
Sophia
i am trying to populate the html
Rohit 007
How to set session variable to value in input fields?
Rohit 007
I've tried value={{ request.session.get('first_name')}}"
Rohit 007
But it gives an error like could not parse the reminder ('first_name') from request.session.get('first_name')
Abdullaev
guys, has somebody used sqlalchemy orm?
Is there similar thing like .where(python code) in django orm?
Abdullaev
i find django's .filter weird
Mirco
Mohd
Linter pycodestyle doesn't installed?
Kaps
Kaps
request.session
Kaps
anyone created dynamic menus from db and used bootstrap dropdown
Nyior
Hey guys, we worked on this CLI tool that helps you scaffold Django Rest projects with:
- Out of the box authentication endpoints, auto-generated docs, pre-commit hooks, docker support etc. We provide three templates you could select from, based on your use-case.
- Auto-generated CRUD endpoints for the database models you define.
- Creation of multiple Django apps at once.
We are super open to whatever feedback that could help us improve this tool, so please keep'em coming. If you star the repo too we'd be grateful :)
Link to Repo: https://github.com/py-universe/django-rest-cli
k
In drf readonlymodelviewset class. I want to use a mixin for this class which should be called , if there is a search parameter in the url. eg : url?search=query.
How can I do this. The code is not reaching the mixin hence neither the function.
k
Between the Qs you should use "|" not ", ".
Anonymous
Somebody
Hi . i have a doubt. i used dropdown features in my base html file. the dropdown not working. any suggestions??
Ramesh
I am passing form data {list} in ajax how to split in list int value in views.py
Егор
Somebody
Read the rules man
i think i didn't do any wrong activity. i am just asking doubts. if you know the answer please share
𝚂𝚘𝚑𝚛𝚎𝚝
Hello. I'm trying to publish a project with DigitalOcean. How can I delete the Apache2 default page? I tried everything and it didn't work.
𝚂𝚘𝚑𝚛𝚎𝚝
André
hey guys, quick help to fix something ugly...
with open('/bla.json') as f:
element_data = f.readlines()
element_data_dict = json.loads(element_data[0])
# add meta data
element_data_dict['meta'] = somefunction()
return HttpResponse(json.dumps(element_data_dict), headers={
'Content-Type': 'application/json'
})
how can i somehow monkeypatch element_data with the dict returned by somefunction
readlines is not the way to go here anyway I guess
Perhaps a buffer for the string, seek 0 and dump it into a dict?
Jorge
I would read the json this way:
with open("bla.json", encoding="utf-8") as f:
element_data_dict = json.load(f)
Baba
Im trying to create a model where only users can see their profile and their posts but I really don't know how to use that OneToOne model ,pls can anyhow explain to me very clearly,been stuck on this for 3 days
Baba
Pls anyone ASAP
Doragonsureiyā
Pls anyone ASAP
Is it urgent?
You shouldn't be here, wasting time and poking strangers and waiting for them to do your job for you.
Search on Google/DuckDuckGo, do the research, and solve your problem yourself, nobody here will drop what they're doing to do your job, just because "it's urgent!".
Have a nice day! 😉
Baba
I only need an explanation, if help just help, I think that's what this group for
Baba
Can you explain?
Vikash
For current user
Baba
Vikash
If you want that only current user will se own post and profile then u add condition for it
VBELLO TECH
Hi
I've been trying to integrate stripe charges into my django website and it has been sucessful so far but when i make a payment, the customer is been created but the card is not been charged and it returns an error that says customer has no active card.
I've searched online and no solution that I've seen so far has helped me. I would really appreciate your help guys.
VBELLO TECH
Mohd
How to use authentication for login ?
Daniel
Good evening please is there anyone here that has integrated resume parsing with django
I've tried it but I have issues installing spacy library and some other libraries
Due to my django version is newer
Getnet
Hi every one , how can fix this problem,ImportError: cannot import name 'url' from 'django.conf.urls' (C:\Users\GetMan\AppData\Local\Programs\Python\Python310\lib\site-package
s\django\conf\urls\__init__.py)
Ivan
Hi everyone, I have a question about django + whitenoise, it is similar to this: https://stackoverflow.com/questions/38746109/django-whitenoise-collectstatic-repeatedly-post-processes-css-files
quoting this post:
> My problem is when running the collectstatic command. WhiteNoise post-processes all my .css files, even when they have not changed. It does not unnecessarily post-process .js or .png files, only .css files.
in the post scenario, the problem was more about the development environment, but in my case it is more about the production environment and specifically about js files.
as the deployment is very slow because this step, we were planning to have a mounted folder for the static stuff ... but if would rerun for all the files, that is still painful
Rohit
Guys anyway to check the performance of django api like how much execution time taken by different query in code. I found few tools like django debug toolbar, silk etc there are showing metrics on UI. Is there any to get that metrics on console ??
Kojo 🦉
Guys, I'm stuck with this pesky error. "Username must be set". I'm currently working on a student mgt. system. The error is thrown because I'm using create_user to create any user who fills and submit my Bootsrap5 form "Add Staff". When I submit I get the "Value Error:Username must be set".
Kojo 🦉
I don't know if I should override django's create_user.
AS9
Anyone have any idea about how to make donation page in website
AS9
Using django
Ritik
Anyone guide me to learn django
Ritik
And i also work for us
Doragonsureiyā
Anyone guide me to learn django
Looking for Django tutorials? you can follow these three recommended ones:
* Official documentation and tutorial
* Tutorial from MDN
* Tutorial from django-girls
Ritik
Tq 😊
Ashish
Ashish
You*
Cool
Has Anyone Made Job Hiring Portal in Django?
Doragonsureiyā
Has Anyone Made Job Hiring Portal in Django?
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z!"
Just ask directly! The better you are at explaining the problem, the more likely you are to get help.
Asking smart questions
Denis
Denis
Module URL was deprecated in Django 3.1 and was deleted in 4.0
Cool
Denis
Charly
Cool
Cool
Which is the Best Place to find good Awesome UI Templates for Django? The UI in Django Looks too bad as compared to React App