Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can I save 2 entries to my models that are referencing each other?
I have 2 models, "Listing" and "Bid" Bids: # bids and bidder class Bid(models.Model): bid = models.IntegerField(default=10) #default soll durch user gesetzt werden # Foreign Keys bidder = models.ForeignKey(User, on_delete=models.CASCADE, related_name="bids") listing = models.ForeignKey(Listing, on_delete=models.CASCADE, related_name="bids") Listing: # all information related to a listing class Listing(models.Model): creation_date = models.DateTimeField(auto_now_add=True, null=True) title = models.CharField(max_length=100, null=True) description = models.CharField(max_length=100) image = models.URLField(max_length=200, default="https://user-images.githubusercontent.com/24848110/33519396-7e56363c-d79d-11e7-969b-09782f5ccbab.png") bid = models.IntegerField(default=10) auction_open = models.BooleanField(default=True) # Foreign Keys author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="listings") place_bid(): def place_bid(request, listing_id): bidder = request.user bid = request.POST.get("bid") listing_entry = Listing.objects.get(pk=listing_id) bid_entry = Bid(listing=listing_entry, bid=bid, bidder=bidder) bid_entry.save() listing_entry.bid = bid_entry listing_entry.save() return; In a function "place_bid()" I want to create a new "Bid"-instance that references a already existing "Listing"-instance using a foreign key. The problem arrises because of what I want to do next: I want to change the same "Listing"-instance that was just referenced, I want to replace the "Bid" object of that Listing object to that "Bid"-object I just created. Can you please help me out there:) -
my author of the comment is showing null django
The author of the post is shown correctly but when I use the same for comment it is returning NULL instead of the author. models.py from django.conf import settings from django.contrib.auth.models import User from django.urls import reverse from django.template.defaultfilters import slugify from ckeditor.fields import RichTextField from ckeditor_uploader.fields import RichTextUploadingField class BlogPost(models.Model): title = models.CharField(max_length = 50 , null=False,blank=False) #body = models.TextField(max_length = 5000 , null=False,blank=False) body = RichTextUploadingField(blank=True,null= True) date_published = models.DateTimeField(auto_now_add=True) date_update = models.DateTimeField(auto_now_add=True) author = models.ForeignKey(User,on_delete=models.CASCADE) #slug = models.SlugField(blank=True,unique=True) def __str__(self): return self.title def get_absolute_url(self): return reverse('post:article-detail', args=(self.id,)) class comment(models.Model): BlogPost = models.ForeignKey(BlogPost,related_name="comments", on_delete=models.CASCADE) name = models.CharField(max_length = 250) body = models.TextField(max_length = 5000) date_added = models.DateTimeField(auto_now_add=True) #author = models.ForeignKey(User,on_delete=models.CASCADE) author = models.ForeignKey(User,null=True,on_delete=models.CASCADE) def __str__(self): return '%s %s' % (self.BlogPost.title, self.name) if "null=True" is not written in the author field then it it giving me this error "NOT NULL constraint failed: post_comment.author_id" -
I am facing a error about Django related to make migration ...how can I fix it? the version of installed Django is 3.1.5
File "C:\Users\Yogiraj Patil\PycharmProjects\myproject\venv\lib\site-packages\django\db\utils.py", line 122, in load_backend raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: 'django.db.backends.postgreysql' isn't an available database backend. Try using 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'postgresql', 'sqlite3' -
Get method in Django's detailview
This is my industry_employeelist detail view and it works perfectly. class industry_employeelist(DetailView): model = Industry template_name = 'app/industry_employeelist.html' def get_queryset(self): return Industry.objects.filter(user=self.request.user) def get_object(self): return get_object_or_404(Industry, user=self.request.user) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) this_industry = get_object_or_404(Industry.objects.filter(user=self.request.user)) context['employeeList'] = self.object.employee_set.all() return context def post(self, request, *args, **kwargs): this_industry = get_object_or_404(Industry.objects.filter(user=request.user)) this_name = request.POST['name'] this_rank = request.POST['rank'] this_email = request.POST['email'] this_phone = request.POST['phone'] this_nid = request.POST['nid'] this_address = request.POST['address'] employee_obj = Employee.objects.create( industry=this_industry, name=this_name, rank=this_rank, email=this_email, phone=this_phone, nid=this_nid, address=this_address ) employee_obj.save() return redirect('app:industry_employeelist') Now I want to make an auto-search suggestion for my project. Looking for a tutorial: youtubelink, and Doc. When I add the get method to the industry_employeelist detail-view it does not work anymore. def get(self, request, *args, **kwargs): this_industry = get_object_or_404(Industry.objects.filter(user=request.user)) if 'term' in request.GET: srckey = request.GET.get('term') suggession = this_industry.employee_set.all().filter(name__contains=srckey) sug_list = list() for i in suggession: sug_list.append(i.name) return JsonResponse(sug_list, safe=False) context = super().get_context_data(**kwargs) Please suggest how to fix it? my template(if you want to check): <!DOCTYPE html> {% extends 'app/base.html' %} {% load static %} {% block content %} <div class="content-fluid my-5"> <div class="row d-flex justify-content-center m-0 mb-3"> <div class="our-service-head"> <p class="our-service-title text-center">Your Employee List</p> <p class="our-service-subtitle text-center px-3"> Nulla ullamcorper bibendum orci, ac tempor nisl lacinia … -
Django form not submitting data
I'm making a simple to do list app. I have a form that is not submitting upon clicking submit. When I click submit the following url appears: http://127.0.0.1:8000/update_task/1/? csrfmiddlewaretoken=k8tpRlypuPUsckyGE4sekciegDUl0ghBqxelylScAUiZJeEs3AOnYWO1K6HATTgC&title=Go+shopping%28Updated%29&complete=on&Update+Task=Submit Here is my code: views.py from django.shortcuts import render, redirect from .models import Task from .forms import TaskForm def index(request): tasks = Task.objects.all() form = TaskForm() if request.method == "POST": form = TaskForm(request.POST) if form.is_valid(): form.save() return redirect('/') context = {'tasks':tasks, 'form':form} return render(request, 'task/list.html', context) def updateTask(request, pk): task = Task.objects.get(id=pk) form = TaskForm(instance=task) if request.method == "POST": form = TaskForm(request.POST, instance=task) if form.is_valid(): form.save() return redirect('/') context = {'form':form} return render(request, 'task/update_task.html', context) update_task.html <h5>Update Task</h5> <form class="POST" action=""> {% csrf_token %} {{form}} <input type="submit" name='Update Task'> </form> list.html <h2>To Do</h2> <div class="center-column"> <form method="POST" action="/"> {% csrf_token %} {{form.title}} <input type="submit" name="Create Task"> </form> <div class="todo-list"> {% for task in tasks %} <div class="item-row"> <a href="{% url 'update_task' task.id %}">Update</a> {% if task.complete == True %} <strike>{{task}}</strike> {% else %} <span>{{task}}</span> {% endif %} </div> {% endfor %} </div> </div> task/urls.py from django.urls import path from . import views urlpatterns = [ path('', views.index, name='list'), path('update_task/<str:pk>/', views.updateTask, name='update_task'), ] Thank you for the help. -
Django Objects looping in JavaScript
i want to loop over a object and manipulate it in JavaScript file but i am not able to get these object in JavaScript file although i can loop them if they are in html . But cannot do that in separate JavaScript file -
Django queryset NameError
Just started learning python and using sublime text. trying to run a queryset but getting a NameError. from the error, it seems the table which is in the models.py is not being picked up. the code in models.py shown in screenshot the error im getting is - name 'Stock' is not defined im trying to get the queryset to run such that i can get a list of items from the Stock table models code class Stock(models.Model): category = models.CharField(max_length=50, blank=True, null=True) item_name = models.CharField(max_length=50, blank=True, null=True) view code def list_item(request): title = 'List of list_item' queryset = Stock.objects.all() the error im getting is from the line with queryset -
ForeignKey Field replaced with text input, but not validating in form
I am working on a project that involves some foreign key fields but i converted them to text inputs in a form. I plan to use datalist to display some choices from the foreign keys but users can still input new data in the input field. The problem now is that the form is being submitted but the data isn't validating Here's the code models.py class Todo(models.Model): title = models.CharField(max_length=250) completed = models.BooleanField(default=False) due_date = models.DateTimeField(blank=True) created = models.DateTimeField(auto_now_add=True) tags = models.ManyToManyField(Tag, blank=True) goal = models.ForeignKey( Goal, on_delete=models.SET_DEFAULT, default='', blank=True) context = models.ForeignKey( Context, on_delete=models.SET_DEFAULT, default='', blank=True) project = models.ForeignKey( 'Project', blank=True, on_delete=models.CASCADE,default='') status = models.CharField(choices=status_types, max_length=250, blank=True) priority = models.CharField( choices=priority_types, max_length=250, blank=True, default='none') place = models.CharField(max_length=250, blank=True) def __str__(self): return self.title add_task.html <h5>Add Task</h5> <br><br> <form action="{% url 'todos:add_task' %}" method="POST" id="add-task-form"> {% csrf_token %} {% if form.error %} <p class="alert">{{form.error}}</p> {% endif %} {% for field in form %} {% if field == form.tags %} <div class="form-group row"> <div class="col"> {{field.label_tag}} </div> <div class="col"> {{field}} <datalist id="taglist"> {% for tag in tags %} <option value="{{tag}}"></option> {% endfor %} </datalist> </div> </div> {% elif field == form.context %} <div class="form-group row"> <div class="col"> {{field.label_tag}} </div> <div class="col"> {{field}} … -
DRF list endoint returns 404 while there are objects present in db
There's some problem when I'm trying to retrieve a list of objects. Here is my code (I've reduced it for simplicity) # Models.py class TournamentType(models.Model): name = models.CharField(max_length=255) # Serializers.py class TournamentTypeSerializer(serializers.ModelSerializer): class Meta: model = models.TournamentType fields = ('id', 'name') # Views.py class TournamentTypeViewSet(ReadOnlyModelViewSet): queryset = TournamentType.objects.all() serializer_class = serializers.TournamentTypeSerializer In Swagger I end up seeing 2 request types: http://localhost:8000/api/tournaments/time_control/{id} http://localhost:8000/api/tournaments/time_control/ First one (with ID) returns object as expected. But the second one, which is supposed to return a list, returns a 404 response. I've tried specifying a request type by adding this to the view: def list(self, request): queryset = TournamentType.objects.all() serializer = serializers.TournamentTypeSerializer(queryset, many=True) return Response(serializer.data) But result is still the same. What am I missing? I've checked all the docs, and everything seems to be in place. -
what __str__ is doing in the below code????The two code listed are different
We are creating a python django model.What is the use of __str__below? What str is actually returning and where? Sample code 1 from django.db import models from django.contrib.auth.models import User # Create your models here. class Profile(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) image = models.FileField(upload_to='profile_pics', blank=True,default='default.jpg') def __str__(self): return self.user.username+ " Profile" Sample code 2 from django.db import models from django.contrib.auth.models import User # Create your models here. class Article(models.Model): title = models.CharField(max_length=100) body = models.TextField() date = models.DateTimeField(auto_now_add=True) author = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.title -
ValueError at /newspaperapp/category/sports/ : Field 'id' expected a number but got 'sports'
I am creating categories for news. I am trying to filter the news category wise but getting a value error models.py class category(models.Model): title=models.CharField(max_length = 200) category_image = models.ImageField(upload_to="imgs") def __str__(self): return self.title class newsmodel_1(models.Model): category = models.ForeignKey(category,on_delete=models.CASCADE) title = models.CharField(max_length = 50 , null=False,blank=False) date_published = models.DateTimeField(auto_now_add=True) #details = models.TextField() details = RichTextUploadingField(blank=True,null= True) slug = models.SlugField(blank=True,unique=True) def slug(self): return slugify(self.date_published) this is views.py def index(request): cats=category.objects.all() return render(request,'newspaperapp/index.html',{'cats':cats}) class nowlist(ListView): model = newsmodel_1 template_name = 'newspaperapp/index.html' class newslist(DetailView): model = newsmodel_1 template_name = 'newspaperapp/home.html' context_object_name = 'newspaperapp' class SearchView(ListView): model = newsmodel_1 template_name = 'newspaperapp/search.html' context_object_name = 'all_search_results' def get_queryset(self): result = super(SearchView, self).get_queryset() query = self.request.GET.get('search') # query is of type 'str', convert to datetime start_day = datetime.fromisoformat(query) end_day = start_day + timedelta(days=1) if query: postresult = newsmodel_1.objects.filter( date_published__gte=start_day, date_published__lt=end_day ) result = postresult else: result = None return result def full_news(request): return render(request,'newspaperapp/full-news.html') def CategoryView(request,cats): category_posts = newsmodel_1.objects.filter(category = cats) return render(request,"newspaperapp/categories.html",{'cats':cats,'category_posts':category_posts}) this is urls.py urlpatterns = [ path('',views.index,name='index'), path('date/',nowlist.as_view(),name = "date"), path('<int:pk>',newslist.as_view(),name = "home"), path('results/', SearchView.as_view(), name='search'), path('full_news/',views.full_news,name = "full_news"), path('category/<str:cats>/',views.CategoryView,name='category'), ] categories.html <h1>{{cats}} category</h1> <ul> {%for post in category_posts%} <h3><a href="{%url 'newspaperapp:home' newspaperapp.pk %}">{{ newspaperapp.title}} {{newspaperapp.category}}</a></h3> {% endfor %} index.html {% for cat in … -
Change auto increment id to last without django ORM
i want refresh auto increment order_id from between rows to next of last row in database layer without Django ORM. my order_id field is integer and it's auto increment in MySQL for example i have 1, 2, 3, 4, 5 and i want update order_id from 3 to 6 id without get last order_id with Django ORM. is it possible? my model is like this: class Order(models.Model): order_id = models.BigIntegerField(unique=True) -
when I change urlconfig,images does not load in django
when I change urlconf my images are not load in the page. this code is when the images are loaded in the page,"urls.py" urlpatterns = [ path('admin/', admin.site.urls), path('<lang>/', home_page), path('', home_redirect), path('products/', include('products.urls')), path('', include('agents.urls')), path('', include('information.urls')), path('', include('media_app.urls')), ] in this code when the images are not loaded urlpatterns = [ path('admin/', admin.site.urls), path('<lang>/', home_page), path('', home_redirect), path('<lang>/products/', include('products.urls')), path('<lang>/', include('agents.urls')), path('<lang>/', include('information.urls')), path('<lang>/', include('media_app.urls')), ] I have no idea for solve it... -
Django:MEDIA_ROOT error : _getfullpathname: path should be string, bytes or os.PathLike, not tuple
I am new to Django Framework.I am trying to upload image to the customer table and this error occurs _getfullpathname: path should be string, bytes or os.PathLike,. I am using this code to upload MEDIA_ROOT = [BASE_DIR, 'static/images'].I change the code to MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images'), but,it says NameError: name 'os' not defined..what's the reason for the errors and how solve it? settings.py STATIC_URL = '/static/' MEDIA = '/images/' STATICFILES_DIRS = [BASE_DIR, 'static'] MEDIA_ROOT = [BASE_DIR, 'static/images'] models.py class Customer(models.Model): user = models.OneToOneField(User, null=True, on_delete=models.CASCADE) name = models.CharField(max_length=200, null=True) phone = models.CharField(max_length=11, null=True) email = models.EmailField(max_length=200, null=True) profile_pic = models.ImageField(null=True, blank=True) date_created = models.DateTimeField(auto_now_add=True, null=True) -
WSGI apache Unsupported Media Type error in custom http request
I am using Django to receive request from an AVR. I uses an custom http POST request containing some byte. I receive data and store successfully to my database when I use manage.py runserver. But when I WSGI in apache (WSGIDaemonProcess) I get this error: [wsgi:error] [pid 5080] [remote 222.157.163.133:4773] Unsupported Media Type: /api/micro/data How can I fix it? -
Django: app displays 400 error when deployed on server
Actually I have two problem here.I have one vps(bare minimum for testing) on which I have 2-3 apps.I have just deployed another app on it & got a free domain name from freenom.com.I use supervisor+nginx for hosting the app.For no reason I am getting this Bad Request (400) when I visit the domain.Generally this occurs when you don't put the the domain name in the ALLOWED_HOSTS list but I have set this up. The second problem is that I have DEBUG = True still it's just displaying the bare minimum error response instead of full stack trace hence I am not sure what errors I am actually getting & unable to debug it. No error logs in the gunicorn-error.log file. No error logs in the nginx-error.log file. No error logs in the nginx-access.log file. My gunicorn_start config #!/bin/bash NAME="hrms_app" DIR=/home/kunsab/projects/hrms_venv/hrms USER=kunsab GROUP=kunsab WORKERS=3 BIND=127.0.0.1:8081 DJANGO_SETTINGS_MODULE=hrms.settings DJANGO_WSGI_MODULE=hrms.wsgi LOG_LEVEL=error cd $DIR source ../bin/activate export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE export PYTHONPATH=$DIR:$PYTHONPATH exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \ --name $NAME \ --workers $WORKERS \ --user=$USER \ --group=$GROUP \ --bind=$BIND \ --log-level=$LOG_LEVEL \ --log-file=- supervisor config: [program:hrms_app] command=/home/kunsab/projects/hrms_venv/bin/gunicorn_start user=kunsab autostart=true autorestart=true redirect_stderr=true stdout_logfile=/home/kunsab/projects/hrms_venv/logs/gunicorn-error.log settings.py """ Django settings for hrms project. Generated by 'django-admin startproject' using Django 3.1.3. For more information … -
How to load only active data in Django Forms
I have a model that is referenced to my Profile by ForeignKey. During registration, I want to load this model that is active only. My Profile model: residence_status = models.ForeignKey("residencestatus.ResidenceStatus", verbose_name="ResidenceStatus", related_name="Profile", on_delete=models.CASCADE) My Residence Status Model: is_active = models.BooleanField(default=False, null=False) Created a separate py file to get the residence status and return as an object(Since there are a lot of models like this) def get_residence_status(): resObjs = ResidenceStatus.objects.all().filter(is_active=True) return resObjs Then on my forms, load it all on choices: class ProfileForm(forms.ModelForm): class Meta: model = Profile fields = "__all__" def __init__(self, *args, **kwargs): RESIDENCE_STATUS_CHOICE = {} resObj = get_residence_status() for x in resObj: print(x) RESIDENCE_STATUS_CHOICE['id'] = x super().__init__(*args, **kwargs) self.fields['residence_status'] = forms.ChoiceField(choices=RESIDENCE_STATUS_CHOICE) On my terminal, the result if print(x) and print(RESIDENCE_STATUS_CHOICES) are as follows: 特になし {'id': <ResidenceStatus: 特になし>} 特定技能外国人 {'id': <ResidenceStatus: 特定技能外国人>} '高度人材 {'id': <ResidenceStatus: '高度人材>} その他 {'id': <ResidenceStatus: その他>} However, the return on my template(select) is only "d" -
How to write a condition use django queryset
I write a if else statement to user but it not working. I get data form database use Post.objects.get(sno = delpk). Then i writer a condition request.user.username == Post.author def postdelapi(request): if request.method == 'POST': delpk = request.POST['delpk'] deletepost = Post.objects.get(sno = delpk) print(Post.author) if request.user.username == Post.author : deletepost.delete() else: HttpResponse('eroor') else: pass return redirect('home') -
Wishlist functionality in Django
I am trying to implement wish list functionality My requirement is In my website I have deals page, coupons page, promotions page. For deals page I have some list of products for each product it has on fav icon. If user clicks on fav icon it has drop down list by default deals and then create new list two columns and if user choose deals that product added to deals list. or else if user clicks on create new list user will create some list then that product added that new list. By list wise we have to shown in wish list template page. How can i achieve this please any one can help to achieve this thank you. -
Django How to user FormSet with ListView
I'm trying to use modelformset_factory with ListView to Update multiple rows in the model. It works fine just subclassing the FormView, but I would like to pagenate it. -
How to access a txt file in django via url for verification purposes
I have purchased an SSL certificate and I used an HTTP validation method where I need to store a text file under my server. I am supposed to store is as http://eblossom.lk/.well-known/pki-validation/ECB7.txt. I am hosting through Linode(Ubuntu) using apache2. However, for some reason, my website cannot access the folder and gives me an error saying that the URL is invalid. I know for a fact that if I type something like http://eblossom.lk/static/style.css, my static file appears, similarly, I need to allow my SSL certificate provider to get access to my .txt file the same way by. Note: FOLDER NAME CANNOT BE CHANGED I am sure something should be done with the settings.py file to allow access to open that folder, but I am not sure how. Any ideas? Thanks! -
Multiply input values into other input
I want to multiply numbers and the result shows in another input. I managed to obtain the value of each input with the following code, but from here I do not know how to advance and make it multiply and that the result is shown in the input of the "total". This is part of the code: $(` [name='unidadTrabajosFactura'], [name='precioUniTrabajoFactura'], [name='totalTrabajoFactura'] `).each( function(index, item){ var valores = $(item).val(); console.log(valores) }); in the console I get the following results: What I want to achieve is that the quantity value is multiplied by the unit price and show the result in in input of total An this is my form code <div class="job-form row mb-3"> <div class="col-md-1"> <label for="unidadTrabajosFactura" class="">Unidad</label> <input type="text" name="unidadTrabajosFactura" class="form-control" value="{{trabajo.unidad}}"> </div> <div class="col-md-5"> <label for="descTrabajosFactura" class="">Descripción</label> <input type="text" name="descTrabajosFactura" maxlength="200" class="form-control" value="{{trabajo.trabajo}}"> </div> <div class="col-md-2"> <label for="precioUniTrabajoFactura" class="">Precio Unitario</label> <input type="text" name="precioUniTrabajoFactura" class="form-control" value="{{trabajo.precio_unitario}}"> </div> <div class="col-md-2"> <label for="totalTrabajoFactura" class="">Total</label> <input type="text" name="totalTrabajoFactura" class="form-control" value="{{trabajo.total}}"> </div> These fields can be multiple as well as one Regards -
Filter the data generated from DB - Django
How to limit the generated list from database? I have a model that references to other models via ForeignKey. class ApplicantAccount: sns_name = models.ForeignKey("sns_names.SnsNames", verbose_name="SnsNames", related_name="ApplicantAccount", on_delete=models.CASCADE) With this line, all of the list inside SNS would be displayed in template. However, in my SNS model, I have added a boolean field is_active. I just want to render only the active SNS. How to do this? At first, I created a py file that would handle all the generated list like this: models: def get_sns(): # Get all active SNS Names snsObjs = SnsNames.objects.all().filter(is_active=True) return snsObjs Then on view, pass it to context then render it to template view.py: snsObjs = get_sns() context['snsObjs'] = snsObjs return render(request, 'forms/reg_form.html', context) But on my template, it displays everything. I just found out that even if I remove the code from views.py, snsObjs = get_sns() context['snsObjs'] = snsObjs it still generates all the list. -
Updating template with a form through context or fetch
I'm on a project and i need a way to get a django form as a response to a fetch request or maybe to re-render my template with the context dictionary updated with the form in it. I want to add the form to a modal box when the button is clicked. Thanks guys -
Trouble loading static files in Nginx + Digital Ocean Deployment
Django Beginner here.. Having some trouble loading my static files during final deployment on a Digital Ocean Droplet I'm using Nginx and Gunicorn. I've followed a tutorial from Traversy Media, but I can not get my static files to show up in the browser via my Digital Ocean ipv4. Upon inspecting it is throwing these multiple errors. Refused to apply style from 'http://162.243.162.127/btre/static/css/all.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. GET 162.243.162.127/:510 GET http://162.243.162.127/btre/static/js/bootstrap.bundle.min.js net::ERR_ABORTED 404 (Not Found) Here are my nginx settings server { listen 80; server_name 162.243.162.127; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/djangoadmin/pyapps/realestate_project; } location /media/ { root /home/djangoadmin/pyapps/realestate_project; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } } Here are my gunicorn settings [Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] User=djangoadmin Group=www-data WorkingDirectory=/home/djangoadmin/pyapps/realestate_project ExecStart=/home/djangoadmin/pyapps/venv/bin/gunicorn \ --access-logfile - \ --workers 3 \ --bind unix:/run/gunicorn.sock \ btre.wsgi:application [Install] WantedBy=multi-user.target I've tried running collectstatic in the terminal multiple times but it does not do anything.. Says it has '0 to collect'.