Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
IntegrityError at /profiles/profile/ NOT NULL constraint failed: profiles_userprofile.user_id
I am using django 3.0.3 and python 3.8.5 Well I want following functionality on my website for userprofile. 1- first time when a person sign up he can able to create his profile by clicking on profile button but after creating profile when he again click on profile button than he will be able to edit his profile not again creating profile. I am trying to make this with class base views because as a beginner cbvs are easy to use and easy to understand. I am trying with the code given below but running through an error which is: IntegrityError at /profiles/profile/ NOT NULL constraint failed: profiles_userprofile.user_id profile/models.py class UserProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) first_name = models.CharField(("First Name"), max_length=50) last_name = models.CharField(("Last Name"), max_length=50) profile_pic = models.ImageField(upload_to='Displays', height_field=None, width_field=None, max_length=None) phone_number = models.IntegerField(("Phone Number")) email = models.EmailField(("Email Address"), max_length=254) city = models.CharField(("City"), max_length=50) bio = models.CharField(("Bio"), max_length=50) def __str__(self): return self.email def get_absolute_url(self): return reverse("profiles:userprofile_detail", kwargs={"pk": self.pk}) def create_profile(sender, **kwargs): if kwargs['created']: profile = UserProfile.objects.create(user=kwargs['instance']) post_save.connect(create_profile, sender=User) profiles/forms.py class Meta: model = UserProfile fields = ("profile_pic","first_name","last_name",'email',"phone_number","bio","city",) def __init__(self,*args, **kwargs): super().__init__(*args, **kwargs) self.fields['first_name'].label = 'First Name ' self.fields['last_name'].label ='Last Name ' self.fields['profile_pic'].label = 'Profile Picture' self.fields['phone_number'].label = 'Phone No. ' … -
request.FILES returns <MultiValueDict: {}> Django
what is the problem with my code request.FILES returns <MultiValueDict: {}> can you help me with this? I am a beginner in django models.py (in using here is the reconsider_attachment) class TaskDocument(models.Model): task = models.ForeignKey(Task, on_delete=models.CASCADE, related_name='task_documents') attachment = models.FileField(upload_to='task_attachments/', blank = True, null = True) created_at = models.DateTimeField(auto_now_add=True) document_tag = models.CharField(max_length = 30, blank = True, null = True) reconsider_attachment = models.FileField(blank = True, null = True) forms.py class AppealAddAttachmentForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for myField in self.fields: self.fields[myField].widget.attrs['class'] = 'form-control' self.fields['reconsider_attachment'].required = False class Meta: model = TaskDocument fields = ['reconsider_attachment',] class AppealOTForm(forms.Form): description = forms.CharField(widget = forms.Textarea(attrs = {'rows':'3'})) views.py def ot_appeal_view(request, pk): task = get_object_or_404(Task, pk=pk) if request.method == 'POST': appeal_ot_form_description = AppealOTForm(request.POST) appeal_ot_form_file = AppealAddAttachmentForm(request.POST , request.FILES) if appeal_ot_form_description.is_valid(): description = appeal_ot_form_description.cleaned_data['description'] task.appeal_description = description task.status = "FOR RE-APPROVAL" task.save() if appeal_ot_form_file.is_valid(): file = appeal_ot_form_file.save(commit = False) file.task = task print(request.FILES , request.POST) file.save() return redirect('ot_task_list') html template (MODAL) {% load crispy_forms_tags %} <form action="" method="POST" id="appealForm" enctype="multipart/form-data"> {% csrf_token %} <div class="modal fade" id="appealModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Appeal OT</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> {{appeal_ot_form_description|crispy}} {{appeal_ot_form_file|crispy}} … -
Django crud api with json fields in model
I am newbie in Django rest-framework. I am creating a CRUD api to achieve below model. I tried with serializers but then its creating different tables in database and linking them. I want to have single data model and then have the sub objects/models in it as JSON fields. something like this models.py to achieve below json class student(models.Model): students=models.JSONField() class=models.JSONField() subjects=models.JSONField() Is this achievable, please can you point me to the code or example ?? { "student":{ "name" : "bril", "last_name" : "jone" } "class":{ "std" : "8", "section" : "c" } "subjects":{ "mandatory":{ "subj" : "science", "marks" : "68" } "language":{ "subj" : "english", "marks" : "54" } "elective":{ "subj" : "evs", "marks" : "56" } } } -
How can i access image of note model on template
Hope You Are Good I Have A Problem i uploaded multiple images from these models class Note(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE) title = models.CharField(max_length=30) text = models.TextField(null=True,blank=True) created_date = models.DateTimeField(auto_now_add=True) last_modified = models.DateTimeField(auto_now=True) class Images(models.Model): note = models.ForeignKey(Note,on_delete=models.CASCADE) image = models.ImageField(upload_to=user_directory_path,null=True,blank=True) now my question is how can i access images of note in jinja template because this doesn't work <p><span>{{ note.image }}</span></p> my question is how can i get images of note model in html template thanks -
how to do nested routes drf-extensions django using uuid instead of id
I have two Django models - I will change the name of my models here but the idea is the same... class Photo(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4) image = models.ImageField(upload_to='photos') created_at = models.DateTimeField(auto_now_add=True) class Attachment(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4) image = models.ImageField(upload_to='attachments') created_at = models.DateTimeField(auto_now_add=True) photo = models.ForeignKey(Photo, on_delete=models.CASCADE) I have views... class PhotoViewSet(viewsets.ModelViewSet): serializer_class = PhotoSerialzer queryset = Photo.objects.all() class AttachmentViewSet(viewsets.ModelViewSet): serializer_class = AttachmentSerializer queryset = Attachment.objects.all() and in my urls.py file... router = routers.DefaultRouter() router.register(r'photo', views.PhotoViewSet, 'photo') router.register(r'attachments', views.AttachmentViewSet, 'attachment') class NestedDefaultRouter(NestedRouterMixin, routers.DefaultRouter): pass router = NestedDefaultRouter() photo_router = router.register('photo', views.PhotoViewSet) photo_router.register('attachments', views.AttachmentViewSet, basename='photo_attachments', parents_query_lookups=['photo']) So, I am kind of new to Django, only have been coding in Django for a week now and have built a small app where I can upload pictures via admin and upload attachment pictures to those pictures and saved via aws. I've tried letting Django auto create a primary key but for some reason didn't work all too well, that's even if it did - I can't remember, however, with uuid this was not an issue as you can see I am using it in my model. My main error now is that even though I want a url like such... http://127.0.0.1:8000/api/dice/c6e53d17-72ba-4a5f-b72e-26b8b2d25230/attachments/ … -
Correct way to handle lots of external APIs in Django application
We have a Django application that is used as a backend for chatbot query handling. We are not using views and models and databases. The application is connected to XMPP server and get the request directly from XMPP connections. The server gets the request, calls the external APIs, makes the response, and sends the response back to the XMPP connection. What should be ideal way to call the external APIs here: Should we make a common function/call to handle the errors? Should we make different DTO/Serializers for every API response? (without the models) -
Django : How we can add extra fields on the Group model
Hi I am working on django permissions system with Django 2+ . And I want to add extra fields inside the Group model in Django but right now I have no idea how to do that. I tried something like: models.py from django.contrib.auth.models import Group class Group(models.Model): Group.add_to_class('description', models.CharField(max_length=180,null=True, blank=True)) But when I migrate my model then it throwing error as: Migrations for 'auth': /usr/local/lib/python3.6/site-packages/django/contrib/auth/migrations/0010_group_description.py - Add field description to group Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 184, in handle self.write_migration_files(changes) File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 223, in write_migration_files with open(writer.path, "w", encoding='utf-8') as fh: PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/django/contrib/auth/migrations/0010_group_description.py' -
Static files 404 nginx
Please don't mark this a duplicate - I've poured over every thread on this subject and I can't get mine to work. I'm using Django, Gunicorn, and NGINX to host a basic site on a DO droplet. Gunicorn is successfully serving the templates from Django, but I can't get NGINX to serve any static files - they all 404. $domain is my personal domain I'm trying to run it on - I triple checked and there are no typos. /var/www/nginx/error.log after a site load: 2020/09/04 05:20:49 [error] 5782#5782: *91 open() "/home/holden/sites/$domain/static/bootstrap/css/bootstrap.min.css" failed (2: No such file or directory), client: 72.214.132.56, server: $domain, request: "GET /static/bootstrap/css/bootstrap.min.css HTTP/1.1", host: $domain, referrer: "$page_on_domain" 2020/09/04 05:20:49 [error] 5782#5782: *91 open() "/home/holden/sites/$domain/static/base.css" failed (2: No such file or directory), client: 72.214.132.56, server: $domain, request: "GET /static/base.css HTTP/1.1", host: "$domain", referrer: "$page_on_domain" It says No such file or directory but the files are there, the directory listed is correct, and they are owned by the same user that nginx runs as. Here is my nginx site config thing at /etc/nginx/sites-available/$domain: server { server_name $domain www.$domain; location / { proxy_set_header Host $host; proxy_pass http://unix:/tmp/$domain.socket; } location /static/ { root /home/holden/sites/$domain/; } listen 443 ssl; # managed by … -
Use same postgres db for both Rail and Django project?
Recently we are working with Rails Now want to attach module working with Django. Can We use same data Base for both project. Secondly postgresql db is used here.If any framework or gem present that can handle this. -
Django: psycopg2.errors.UndefinedColumn: column "page_image" of "pages_page" relation does not exist
Here is a brief backstory. I am using the Mezzanine CMS for Django. I created some models that inherited from the Mezzanine models. This caused an issue in my Postgres database, where one object was present in two tables. When I would try searching my site for a post, I would not get results from one table. So, here is where I believe I messed up. I reverted my models to how they were before this issue. This meant that there was still a table in my database for those models, so my search function still wouldn't work. I wanted this relation gone, so I did something very stupid and deleted the entire database. This was fine for my local development, because I just recreated the database and migrated. When I try deploying this project of mine with the newly created postgres database onto DigitalOcean, I get to this command: $ python manage.py createdb --nodata --noinput which gives me the error: psycopg2.errors.UndefinedColumn: column "page_image" of "pages_page" relation does not exist LINE 1: UPDATE "pages_page" SET "page_image" = '', "keywords_string"... I looked up a few threads on this error, and tried this solution that did not work: python manage.py shell >>> … -
What should I use to deploy a python based image analysis program for an end-user on a server
I have written an SEM (Scanning electron image)-image analysis program in Python which is capable of calculating all the microstructural properties in an SEM image e.g. Identification of different areas in the image 2) calculate the area of specific regions in microns, diameters, circularity, etc. The final results are in the form of a graph(area in microns vs cumulative frequency vs percentage contribution) plotted with the help of Matplotlibrary in Python. I want to give this program on a server where anyone can use it through an interface without looking at the code. I am confused that what should I use to do so? Will Django be a good choice for this? But I suspect Django cannot perform all the tasks (Not sure). I have also read about Jenkins servers. Please guide me which approach should I use to deploy this image analysis program for any user on a server. Thanks -
What causes processing time differences running REST endpoint from different sources?
Background: We are creating a SAAS app using Vue front-end, Django/DRF backend, Postgresgl, all running in a Docker environment. The benchmarks below were run on our local dev machines. The process to register a new "owner" is rather complex. It does the following: Create tenant and schema Run migrations (done in the create schema process) Create MinIO bucket Load "production" fixtures Run sync_permissions Create an owner instance in the newly created schema We are seeing some significant differences in processing times for some of the above steps running the registration process in different ways. In trying to figure out our issue, we have tried the following four methods to invoke the registration process: from the Vue front-end hitting the API endpoint from a REST client (Talend) from the APIBrowser (provided by DRF) (in some cases) via manage.py We tried it from the REST client to try to eliminate Vue as the culprit, but we got similar times between Vue and the REST client. We also saw similar times between the APIBrowser and the manage.py method, so in the tables below, we are comparing Talend to APIBrowser (or manage.py). The issue: Here are the processing times for several of the steps … -
Semantic Versioning for Django
I am building a dashboard with Django and want to use semantic versioning on github. However, I am struggling to understand when would be a good time to change major vs. minor vs. patch? Could someone provide some examples? -
Filtering Django models but only the many to many through table
I am trying to list all contact but only the primary address. There is a many to many relationship between Contact and Address with a custom through table that contains additional attributes such as "primary". Below is the core of the models. class Address(models.mode): address1 = models.CharField(max_length=100) ... class Contact(models.model): ... address = models.ManyToManyField(Address, through='ContactAddress') class ContactAddress(models.model): contact = models.ForeignKey(Contact, on_delete=models.CASCADE) address = models.ForeignKey(Address, on_delete=models.CASCADE) address_type = models.ForeignKey(ContactAddressType, on_delete=models.CASCADE) primary = models.BooleanField(default=False) Contact.objects.all() return all the contacts. I loop through them to retrieve contact data: for contact in contact I then loop the addresses in an inner loop: for a in contact.address.all How do i limit the address to just the address with the primary=True on the ContactAddress through table? I still want all contacts, but only the primary address for each contact. I was hoping to filter at the top level where i return all the contact but anything i tried limits the contacts that are returned to just those that have a primary address. I want all contacts but only the primary address for each (or no address if no primary address is set on a contact). -
Pip install in /var/www
So I have this project where I need to write a bash script to build a production server for a Django App in Apache and at some point I need to install all the dependencies inside a virtual environment, the problem is that I cannot run pip install because I need permissions to write into that folder and if I try to do sudo pip install it doesn't recognize the command pip. My folder structure is something like /var /www /app /venv /bin /django /django_app What could be the best approach to solve this problem? -
Django template split a string in two parts
In my Django project i hae to split a string into a template based on a specific char. str1 = "Part1 - Part2" in pure python I would do it like this: part1 = str1.split("-",1)[0] part2 = str1.split("-",1)[1] using django template instead i try: {{ str1|split:'-'|first }} but i give an error: Invalid filter: 'split' Someone can help me for split my variable ina django template and take just the first or second part based on a specific char? So many thanks in advance -
Django How to Post comment on only one List item
I am trying to create django commerce app I am little bit stuck on a thing When I post comment via form I created <form action="{% url 'comment' list_id.id %}" method="POST"> {% csrf_token %} <textarea name="comment" class="inp-cmt" rows="3"></textarea> <input type="submit"> </form> the comment is posted but it post on all of my list page I wanted only on the page where comment is posted my comment section {% if allcomments %} <h1>Comments</h1> <div class="card-cmt"> {%for com in allcomments%} <li style="list-style: none;"> <footer class="post-info"> <span>{{com.user}}</span> <p>{{com.text}}</p> </footer> </li> {% endfor %} </div> {% endif %} my urls urlpatterns = [ path("", views.index, name="index"), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("register", views.register, name="register"), path("newlist", views.create_listing, name="new_list"), path("item", views.add_item, name="new_item"), path("listing/<int:list_id>", views.listing, name="listing"), path("delete/<int:item_id>", views.delete_list, name="delete"), path("comment/<int:list_id>", views.comments, name="comment") ] my views for comment and listing def comments(request, list_id): coms = Comments() if request.method == 'POST': coms.user = request.user.username coms.text = request.POST.get('comment') coms.listid = list_id coms.save() return redirect('listing', list_id) else : return redirect('index') def listing(request, list_id): list_item = Listing.objects.get(id=list_id) return render(request, "auctions/listing.html",{ "list_id" : list_item, "allcomments" : Comments.objects.all() }) models class Listing(models.Model): owner = models.CharField(max_length =64,default="N/A") productname = models.CharField(max_length=100) price = models.DecimalField(max_digits=10, decimal_places=2) description = models.CharField(max_length=999, default="test") date = models.DateField(auto_now_add=True) link = models.CharField(max_length=200, … -
How Automatically Update The Page On a new "question" in Django using AJAX
I'am Working On A Q&A; Web Application. It was completed, but i have noticed a small bug, that is- we have to manually refresh the page in order to get the latest questions posted. But i thought it would be much much better if the page refreshed automatically when a new question was posted. I did hours of research on this, but it didn't solve my problem. Here Are The Reference Links- Django refresh page https://www.codingforentrepreneurs.com/blog/ajaxify-django-forms/ https://docs.djangoproject.com/en/3.1/ref/contrib/messages/ Using Django How Can I Automatically Update Information on a Template auto refresh url in django I didn't manage to find any useful info for me to fix the bug, that is why i posted this question becuase i thought some help by the community Specifications- OS: Windows 10 Python: 3.7.7 Django: 3.0.8 Here Are The Files For The Project- For Further Code Information Please Visit Here- https://github.com/ahmishra/Django-Q-AND-A-App/tree/master views.py from django.shortcuts import render from django.views import generic as genr from .models import Question, Answer from django.contrib.auth import mixins as mxn from django.urls import reverse_lazy # Create your views here. class HomePage(genr.TemplateView): template_name = 'core/home_page.html' class QuestionListView(genr.ListView): model = Question class QuestionDetailView(genr.DetailView): model = Question def get_context_data(self, **kwargs): context = super(QuestionDetailView, self).get_context_data(**kwargs) context['answer_list'] = … -
Exception Value:no such table: appname_tablename?
I tried all possibilities for this issue in Django but it's not resolved at. it will not create 0001_initial.py I tried many ways. python manage.py showmigrations python manage.py makemigrations python manage.py migrate -
When adding a new query in Django, the foreign key gets the value NULL
I am still learning programming and currently experimenting with Django. Currently I am trying to build a task manager but when I try to add a new Tasks(def new_tasks) it should be related to TaskGroup, instead the task_group_id is related to NULL and I can't seem to figure out why. I believe the reason is some where in the views.py -> def new_tasks. Any help is gratefully appreciated. The structure: Project 1 Task Group 1 Tasks 1 Task 1 Task 2 Task 3 Tasks 2 Task 4 Task 5 Task Group 2 Tasks 3 Task 6 Project 2 Task Group 3 Tasks 4 Task 7 Task 8 Relating the Task Group to Project works but relating the Tasks to Task Group gives the value NUll. image of database Models.py from django.db import models from django.contrib.auth.models import User class Project(models.Model): """A project the user is working on.""" text = models.CharField(max_length=200) date_added = models.DateTimeField(auto_now_add=True) owner = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): """Return a string representation of the model.""" return self.text class TaskGroup(models.Model): """ Title of a group of tasks """ project = models.ForeignKey(Project, null=True, on_delete=models.CASCADE) title = models.CharField(max_length=100, blank=True, default='') desc = models.CharField(max_length=300, default='') date_added = models.DateTimeField(auto_now_add=True) def __str__(self): """ Return a string … -
Django with Heroku-PostgreSQL database horizontal scaling
The problem background I am working on a Django project, which is using PostgreSQL and is hosted on Heroku(also using heroku-postgres). After some time, the amount of data becomes very big and that slows down the application. I tried replication in order to read from multiple databases, that helped reducing the queue and connection time, but the big table is still the problem. I can split the data based on group of users, different group do not need to interact with each other. I have read into Sharding. But since we use heroku-postgres, it's hard to customize the sharding So I have come up with 2 different ideas below 1. The app cluster with multi-db (Not allowed to embed image yet) Please see the design here We can use the middlewares and database-routers to achieve this But not sure if this is friendly with django 2. The gateway app with multiple sub-apps (Not allowed to embed image yet) Please see the design here This require less effort than the previous design Also possible to set region-based sub-apps in the future My question is: which of the two is more django-friendly and better for scalability in the long run? -
did request.POST['choice'] returns an Integer
I am learning django can you please help me with this selected_choice=question.choice_set.get(pk=request.POST['choice']) ... ... selected_choice.votes+=1; --here the selected_choice is holding a particular choice object but what is the functionality of request.POST['choice]--I'm confused with this -
Not Found: /favicon.ico in django
-I was trying to create a checkout and clearcart button for an ecommerce website using django but after writing some javascript code as below everything works fine except for these two buttons does not appear in my web browser and shows 1-Not Found: /favicon.ico on my pycharm terminal, also says 2-ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine [03/Sep/2020 13:44:01] "GET /shop/favicon.ico HTTP/1.1" 500 59 any suggestions please? function updatePopover(cart) { var popStr = ""; popStr = popStr + " Cart for your items in my shopping cart "; var i = 1; for (var item in cart) { popStr = popStr + "" + i + ". "; popStr = popStr + document.getElementById('name' + item).innerHTML.slice(0, 19) + "... Qty: " + cart[item] + ''; i = i + 1; } popStr = popStr + " Checkout Clear Cart " console.log(popStr); document.getElementById('popcart').setAttribute('data-content', popStr); $('#popcart').popover('show'); } -
Serialisers field for validation django rest api
I am validating my json in using serialiser in django, but i don't know what should be used to check datetime and null value. { "start_date": "2020-12-16 00:00:00", #? "end_date": "2020-12-18 23:59:59", #? "daily_budget": null, # ? "daily_budget_imps": 10, #serializers.IntegerField(read_only=True) "enable_pacing": true, #serializers.BooleanField() "lifetime_budget": null, #? "lifetime_budget_imps": 980, #serializers.IntegerField(read_only=True) "lifetime_pacing": false #serializers.BooleanField() } complete json { "name": "VTest_Through_API_Pravin11", "state": "inactive", "budget_intervals": [ { "start_date": "2020-12-16 00:00:00", "end_date": "2020-12-18 23:59:59", "daily_budget": null, "daily_budget_imps": 10, "enable_pacing": true, "lifetime_budget": null, "lifetime_budget_imps": 980, "lifetime_pacing": false }, { "start_date": "2020-12-19 00:00:00", "end_date": "2020-12-20 23:59:59", "daily_budget": null, "daily_budget_imps": 10, "enable_pacing": true, "lifetime_budget": null, "lifetime_budget_imps": 6, "lifetime_pacing": false } ] } In my serializers file i don't know how to validate time fields.Do i have to customisation for it. class BusSerializer(serializers.Serializer): # start_date = # end_date = daily_budget = FloatField(max_value=None, min_value=None,allow_null=True), daily_budget_imps = serializers.IntegerField(read_only=True), enable_pacing = serializers.BooleanField(), lifetime_budget = FloatField(max_value=None, min_value=None,allow_null=True) lifetime_budget_imps = serializers.IntegerField(read_only=True), lifetime_pacing = serializers.BooleanField(), class IoSerializer(serializers.Serializer): name = serializers.CharField() state = serializers.CharField() budget_intervals = BusSerializer(many=True) -
uwsgi socket wrong group applied
Problem: When I run uwsgi --socket racing_app.sock --wsgi-file racing_app/wsgi.py --chmod-socket=664 as my logged in user, the system creates the socket as my user/group. Then nginx is unable to read the file. Things I've tried: I created a group www-data and added nginx to the group as well as added my user which enabled me to create the socket file with the group of www-data, but it still fails read. What does work is manually changing the file group to nginx. Doesn't work srw-rw-r-- 1 david www-data 0 Sep 3 20:06 racing_app.sock Does work srw-rw-r-- 1 david nginx 0 Sep 3 20:06 racing_app.sock