Amir
Check the code
Doragonsureiyā
Check the code
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
Amir
Can you please give me a sample code, I am new to Hangu
Hercules
are there css files in static folder?
Hercules
if there are, you should set path in setting.py of django
Amir
Amir
Hercules
# settings.py
import os
# Base directory of the project
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
# The directory where Django will look for static files for your apps
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'myapp/static'), # Replace 'myapp' with your app name
]
# The directory where collected static files will be stored (used in production)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
Hercules
Now, you need to link the CSS file in your HTML templates. To do this, you should use Django's {% static %} template tag.
Hercules
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Django App</title>
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
</head>
<body>
<!-- Your content here -->
</body>
</html>
Amir
Taks alot of
Hercules
Amir
I made all these settings, engineer, but I have a problem
Hercules
are you in production?
Amir
Hercules
In production, Django doesn't serve static files itself.
Hercules
You need to configure your web server (e.g., Nginx, Apache) to serve the files from the STATIC_ROOT directory.
Hercules
cofiguration for Nginx
Hercules
server {
listen 80;
server_name yourdomain.com;
location /static/ {
alias /path/to/your/project/staticfiles/;
}
location / {
proxy_pass http://127.0.0.1:8000;
# Other proxy settings
}
}
+=+
Ram
Guys share the best source to learn Django
Doragonsureiyā
Guys share the best source 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
Mael
I want kurz For Backend Django
Maxim
Sing
Can some one please help is there any way to implement push notifications other than pyfcm way
Sing
For push notifications in django
Sing
When i tried with pyfcm locally its working fine after deploying code to heroku server getting double free 503 error
Hart
Hello friends, please can any one suggest a good hosting platform for django
GreenHouse
Hart
Thank you
GreenHouse
welcome
Tukwasi
Good pm all
Tukwasi
Please I need your help
Yahya
Is there any problem with python anywhere
Tukwasi
I don't really know
Tukwasi
Please I want develop Instagram bot using Django, how can I do that
Charly
Tukwasi
So what tool
Charly
But that's Offtopic, we only discuss Django here
Tukwasi
Do I need to define the model or should live it
Charly
Tukwasi
To send bulk messages to user, comment on post
Charly
mbk
How can we implement channels in django?
And for what use they are being used
I have never used channels till now
Sourabh
Amir
Hello, I hope you are well
I had a question, in which folder of the Python virtual machine are the installed modules placed
Shoaib
I started learning python basic and was willing to learn Django and fast api or should i change my decision if framework
Amir
how can i fix ModuleNotFoundError: No module named 'apps.main'
Mirjalolbek
Find module file
Mirjalolbek
Is it pip or local module
Sing
In my django project using pyfcm i implemented push notification locally they are executing fine.
After deploying code to heroku sserver apis are crashing server with 503 error
Can someone help a way to fix or any other approach for push notifocations
Yahya
i want to create a python django project to showcase in my cv
Yahya
which is best can anyone recommend
Yahya
which is best django project for showcase in cv
Doragonsureiyā
which is best django project for showcase in cv
Adding the word Django to your Off-Topic question doesn't magically turn it to a Django related question, so delete your question here and move to the @PythonOfftopic group and ask there.
ishaan
in my django Admin, I have created 20 users. they will upload product content. Now I want that user should only see product added by him/her. Has anyone worked on something like this
GreenHouse
to install django module in venv, I use the commnad "pip install django~=5.04"
but it does not work, while "pip install django" works
Doragonsureiyā
GreenHouse
ishaan
ishaan
only pip install django==5.0.4
ishaan
or whatever the version is
GreenHouse
GreenHouse
without virtual environment, I use 5.04, but for the venv there is error
Charly
GreenHouse
which version can i use
Charly