Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to get queryset values intersection
I try to get values intersection. But function returns a wrong result: qs1 = MyModel.objects.filter(**filters1).values('brand', 'model') qs2 = MyModel.objects.filter(**filters2).values('brand', 'model') result_qs = qs1.intersection(qs2) I see values from qs1 only in result_qs. How can I get intersection of brand-model pairs? -
How to convert an existing quotation to a sales order/project
How would you convert a quotation into a project. I am trying to find the right approach to do this. Issue: At this moment, I`ve got 2 different apps: One for quotation and one for Project. I can create a quote separately and create an project as well. I would like to find the right approach to do this. Goal: I would like to create a button to convert a quote into project. This means all infos from the quote will be pass to the project model. Quotes views.py def create_quote(request): form = QuoteForm(request.POST or None, request.FILES or None) if form.is_valid(): quote = form.save(commit=False) quote.save() return render(request, 'quotes/quote_detail.html', {'quote': quote}) context = { "form": form, } return render(request, 'quotes/create_quote.html', context) models.py class Quote(models.Model): name = models.CharField(max_length=30) description = models.CharField(max_length=30) Project views.py def create_project(request): form = ProjectForm(request.POST or None, request.FILES or None) if form.is_valid(): project = form.save(commit=False) project.save() return render(request, 'projects/detail.html', {'project': project}) context = { "form": form, } return render(request, 'projects/create_project.html', context) models.py class Project(models.Model): user = models.ForeignKey(User, default=1, on_delete=models.CASCADE) description = models.CharField(max_length=30) proposal_ref = models.ForeignKey(Quote, default=1, on_delete=models.CASCADE) -
Django templates do not respect DateTimes in different timezone
In my Django app, I am storing all the DateTime objects as aware objects in UTC. But my users may live in different parts of the world. So, I have set up a form for them to choose their respective time zone. In the backend, I have written Python code to first convert the corresponding DateTime objects to the local time zone using Django's astimezone() function. There is an attribute under the user's profile model that stores the timezone. So, all my code will actually do operations based on the user's local time while in the actual database they are stored as UTC. Now, I seem to have come across a problem and I can't see the reason why this should occur. In the app, I have made a dedicated page to show the users a comparison of the server time and their local time. This is my code view function that renders that page def check_time(request): " A view function that let's user view their local time and server time (usually UTC) at a glance" user = User.objects.get(username=request.user.username) server_time = timezone.now() user_localtime = server_time.astimezone(user.profile.timezone) context = { "server_time": server_time, "user_localtime": user_localtime } return render(request, "ToDo/check_time.html", context=context) check_time.html {% extends … -
Django: the Foreign key is not working or saving in the database
I have model where am using two foreign key. one of them is the logged-in user and one for inheriting the post .but post foreign key is not working or not saving into the database but it should save the particular post chosen by the user or with pk this is my models.py class Booking(models.Model): b_price = models.ForeignKey(price, related_name='b_price',on_delete=models.CASCADE,null=True) user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, default='') approved_price = models.BooleanField(default=False) pay = models.CharField(max_length=30, default='') mode = models.CharField(max_length=30 ,default='') def __str__(self): return str(self.user) **this is my views.py ** class booking_approve(CreateView, LoginRequiredMixin): form_class = forms.booking_form model = Booking template_name = "confirm_booking.html" success_url = reverse_lazy("Loader:post") def form_valid(self, form): print(form.cleaned_data) bk = form.save(commit=False) bk.user = self.request.user bk.save() return super().form_valid(form) this is my urls.py path('confirm_booking/<int:pk>/booking',views.booking_approve.as_view(), name="booking_approve"), this is my post pic when clik on tick buuton next form will appear but it should also taken the id of post.. but it wont the b_price is not select automatically -
Django formset create forms from view
I have a formset and would like to create additional forms after the post is made but before saving. The additional form values are coming from a separate formset input on the same view via a CSV submission. How can I create new forms for a formset? views.py class CreateAuthorView(CreateView): template_name = "author_add.html" model = Author form_class = AuthorForm def get_context_data(self, **kwargs): context = super(CreateAuthorView, self).get_context_data(**kwargs) if self.request.POST: context["books_file"] = BooksFileFormSet(self.request.POST, self.request.FILES) context["books"] = BooksFormSet(self.request.POST) else: context["books_file"] = BooksFileFormSet() context["books"] = BooksFormSet() return context def form_valid(self, form): context = self.get_context_data() books_file = context["books_file"] books = context["books"] self.object = form.save(commit=False) books.instance = self.object if books_file.is_valid(): for book_file in books_file.files: # I am not sure if this is the best way to iterate through the files posted for index, book_file in enumerate(self.request.FILES.get(book_file).read().decode("UTF-8").split("\r\n")): book_file = book_file.split(",") # Values from book_file are added to the empty BooksFormSet; example below books.page = book_file[0] books.content = book_file[2] books.save() return redirect(self.get_success_url()) -
assigning value to django-admin callable function
I am new in the Django world. I came across this project in GitHub. Below is the part of the code from this project which I cannot understand how it works. I will be happy if someone can write a basic description for explanation of this snippet. def oneway_trip(modeladmin, request, querset): querset.update(trip_type="One Way") oneway_trip.short_description = "Set trip type to One Way" -
Can I manage thousands of concurrent connections with a non-Node stack?
I'm developing a social network with Django (Python) + Postgres SQL. My site will have a chat feature so that users can communicate to each other in real-time, and the communication will be only from user-to-user (so there won't be chatrooms with more than two people). For the sake of my question, let's say that in the future my social network has ten millions of registered users, and an average of 20,000 chats open between users at the same time 24/7. Assuming that I run my app on the Cloud (Digital Ocean, AWS or whatever) with a traffic balancer, can I expect my Django + SQL app to run seamlessly or should I use Node JS + noSQL to scale my app without so much pain as it grows? I heard that the ME*N stack is meant for these kind of use cases (real-time applications with thousands of concurrent connections), but I already developed around 25% of my app in Django + Postgres and I get discouraged to think that I will probably have to re-do everything again from scratch. But on the other hand, I heard that some other big websites such as Instagram have been developed using Django, … -
Django unable to find JS static scripts
I have a basic Django app that I am trying to add HTML to. The issue I am having is that for some reason my markdown is not picking up the scripts in my static folder. I'm relatively new to Django so I've included what I think is relevenant. Static folder structure in the project root. -- static ---- css ------ some_css_files ---- images ---- scripts ------ some_scripts Reference scripts in HTML <script type="text/javascript" src="{% static 'scripts/jquery.js' %}"></script> <script type="text/javascript" src="{% static 'scripts/plugins.js' %}"></script> <script type="text/javascript" src="{% static 'scripts/functions.js' %}"></script> From Chrome dev tools, the path looks correct, with the static folder being looked for in the root, but still 404 on all the resources. 0.0.0.0/:13 GET http://0.0.0.0:8000/static/css/bootstrap.css 404 (Not Found) 0.0.0.0/:14 GET http://0.0.0.0:8000/static/css/style.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:15 GET http://0.0.0.0:8000/static/css/swiper.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:16 GET http://0.0.0.0:8000/static/css/dark.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:17 GET http://0.0.0.0:8000/static/css/font-icons.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:18 GET http://0.0.0.0:8000/static/css/animate.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:19 GET http://0.0.0.0:8000/static/css/magnific-popup.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:21 GET http://0.0.0.0:8000/static/app/content/responsive.css net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:221 GET http://0.0.0.0:8000/static/scripts/jquery.js net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:222 GET http://0.0.0.0:8000/static/scripts/plugins.js net::ERR_ABORTED 404 (Not Found) 0.0.0.0/:223 GET http://0.0.0.0:8000/static/scripts/functions.js net::ERR_ABORTED 404 (Not Found) In my settings.py I have the below for static … -
Return values in OneToOneField as string - Django
I have a model with a OneToOneField (pointing to a second model) and I want to return values inside the variables of that second model. This one is the second model: class EstablishmentTable(models.Model): #Tabla de establecimientos #id for the 'pk as we have not declare any etmail = models.CharField(max_length=45) etpass = models.CharField(max_length=1024) #SHA-1024, SHA-512. SHA-256 etname = models.CharField(max_length=30) etnumqueue = models.IntegerField() def __str__(self): return "name: "+self.etname+" mail: "+self.pk This one the first model: class QueueTable(models.Model): #Tabla de colas #id for the 'pk as we have not declare any qtname = models.CharField(max_length=30) qtestablishment = models.OneToOneField(EstablishmentTable, on_delete=models.CASCADE,null=True) qtnumstate = models.IntegerField() qtdate = models.DateField(auto_now_add=True) def __str__(self): return "name: "+self.qtestablishment+" mail: "+self.pk How can I do to access to the qtestablishment variables? If I write return "name: "+self.qtestablishment+" mail: "+self.pk It returns: TypeError: can only concatenate str (not "EstablishmentTable") to str Thank u in advance. -
Django: how to return a view THEN execute wind-down code?
I wonder if the there is a canonical approach to this in Django? Essentially the way views are structured, they are functions that return a result that is ths delivered to the client. It can be as simple as this: from django.http import HttpResponse def my_view(request): return HttpResponse('This is my view!') But let us suppose that when my_view is loaded, there is some meat in it: from django.http import HttpResponse def my_view(request): result = do_stuff() return HttpResponse(result) And that do_stuff has some moderately time consuming wind down code to run, that is code that the result does not depend on, but that it would to run all the same (perhaps to release resources, return some stuff to a clean state etc. it matters not, the principle is that do_stuff has some code it wants to run, it's a little slow, and hence running it delays delivery of the result, but the result in no way whatsoever depends upon it, so it would prefer to return the result and then run this code. In a ridiculous imaginary and nonsensical world this might resemble: from django.http import HttpResponse def my_view(request): result = do_stuff() return HttpResponse(result) do_more_stuff() But of course do_more_stuff never runs … -
How to add select images field for django admin site
I would like to add a field for a model in django that selects an avatar for scenarios from a prespecified list. As avatars can be reused across different scenarios an ImageField would be inefficient because then I'm reuploading images multiple times. This form would only be used by the admin site. Ideally I would like an interface where the administrator would have a radio button grid (or select drop down) showing all the images in the avatar directory (in static files) that they can choose from. The stored value would be a filepathfield so that while rendering templates this avatar can be called in the right scenario. I am new to Django so would appreciate any help (esp if I'm doing something stupid here), I have tried using django-filer but the thumbnails did not display properly and were too small so ideally would just like a simpler radio select. -
apache django python3 can not find project app
[Sun May 24 19:01:33.422360 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] mod_wsgi (pid=10831): Failed to exec Python script file '/mysite/say_hello/say_hello/wsgi.py'. [Sun May 24 19:01:33.422412 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] mod_wsgi (pid=10831): Exception occurred processing WSGI script '/mysite/say_hello/say_hello/wsgi.py'. [Sun May 24 19:01:33.422561 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] Traceback (most recent call last): [Sun May 24 19:01:33.422609 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] File "/mysite/say_hello/say_hello/wsgi.py", line 23, in [Sun May 24 19:01:33.422612 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] application = get_wsgi_application() [Sun May 24 19:01:33.422617 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] File "/root/Envs/web/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Sun May 24 19:01:33.422619 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] django.setup(set_prefix=False) [Sun May 24 19:01:33.422624 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] File "/root/Envs/web/lib/python3.6/site-packages/django/init.py", line 19, in setup [Sun May 24 19:01:33.422626 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Sun May 24 19:01:33.422630 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] File "/root/Envs/web/lib/python3.6/site-packages/django/conf/init.py", line 57, in getattr [Sun May 24 19:01:33.422633 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] self._setup(name) [Sun May 24 19:01:33.422636 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote 61.141.73.28:15850] File "/root/Envs/web/lib/python3.6/site-packages/django/conf/init.py", line 44, in _setup [Sun May 24 19:01:33.422639 2020] [wsgi:error] [pid 10831:tid 140290400163584] [remote … -
How to deploy django project on production without cloudlinux?
I'm having an issue when i have to deploy my project online for that i have to install cloud linux to setup an app on cpanel and cloud linux providing 1 month trial only -
Django Calculated Running Balance
I am working on a Personal Finance App using Django (Creating an API Based Backend). I have a transactions table where I need to maintain the running balance based on the UserID, AccountID, TransactionDate. After Creating, Updating, or Deleting a Transaction I need to update the running balance. The current method I have identified to do this is by running a custom SQL statement which I call once one of the above operations has been done to update this field (see code below): def update_transactions_running_balance(**kwargs): from django.db import connection querystring = '''UPDATE transactions_transactions SET transaction_running_balance = running_balance_calc.calc_running_balance FROM (SELECT transaction_id, transaction_user, transaction_account, SUM(transaction_amount_account_currency) OVER (ORDER BY transaction_user, transaction_account, transaction_date ASC, transaction_id ASC) as calc_running_balance FROM transactions_transactions WHERE transaction_user = {} AND transaction_account = {}) as running_balance_calc WHERE transactions_transactions.transaction_id = running_balance_calc.transaction_id AND transactions_transactions.transaction_user = running_balance_calc.transaction_user AND transactions_transactions.transaction_account = running_balance_calc.transaction_account'''.format(int(kwargs['transaction_user']), int(kwargs['transaction_account'])) with connection.cursor() as cursor: cursor.execute(querystring) However the issue I have is once the table gets a little larger, the response time started to increase (The SELECT statement is where the time is taken). The other issue I have is when I load the server with multiple concurrent create transactions, every once in a while (current rate is 0.25%) the running balance … -
How to create a table of update forms in Django
I want the ability to update records in a table format so that I can quickly make updates. I am close to figuring this out, but form.valid() is still returning False. My model: class Actions(models.Model): meeting = models.ForeignKey(Meeting, on_delete=models.CASCADE) dateAdded = models.DateTimeField(default = timezone.now, editable = False) dateComplete = models.DateTimeField(null=True, blank=True) action = models.TextField(max_length=1000,) responsibility = models.ForeignKey(staff, on_delete=models.CASCADE, blank=True,null = True,) complete = models.BooleanField(default = False) My view: def actionItemsView(request): ActionFormSet = modelformset_factory(Actions, fields=('action', 'responsibility','complete','meeting','dateComplete'),max_num=1) if request.method == "POST": action_formset = ActionFormSet(request.POST, request.FILES,queryset=Actions.objects.filter()) for action_form in action_formset: print(action_form.errors) if action_form.is_valid(): action = action_form.save() else: formset = ActionFormSet(queryset=Actions.objects.filter(complete = False)) return render(request, 'action_items.html', {'formset': formset}) My template: <table class="table table-hover table-sm"> <tr> <th>decision</th> <th>responsibility</th> <th>complete?</th> <th>meeting</th> <th>date complete</th> <th>submit</th> </tr> {%for form in formset%} <form method="post" enctype= multipart/form-data> <tr> {{ formset.management_form }} {{ form.management_form }} {% csrf_token %} <td>{{ form.action }}</td> <td>{{ form.responsibility }}</td> <td>{{ form.complete }}</td> <td>{{ form.meeting }}</td> <td>{{ form.dateComplete }}</td> <td><button type="submit">Save</button></td> </tr> </form> {% endfor %} </table> When I run this, the template is rendered exactly how I would expect, but when I make any changes to an item and hit submit, it throws The view meetings.views.actionItemsView didn't return an HttpResponse object. It returned None instead. Because … -
Generate unique Alphanumeric identifiers in django
I am creating a tracking app for projects where each project will have one or more groups. I want to add an alphanumeric string as the unique identifier (similar to the primary key) for groups. I know about UUID but it is a long string and I am looking for 10-15 characters long. Could you please help me with how can I generate a unique string? -
Detailview and update on the same form django
I want to create an update and detailview on the same page. but apparently my code below is not working fine with me. instead on updating the selected ref_no it creats a new set of records. Please help. Thanks in advance. class RFPNotificationView(DetailView): model = RFP template_name = 'home/rfp_notif.html' def get_context_data(self, **kwargs): context = super(RFPNotificationView, self).get_context_data(**kwargs) context['rfpapproveform'] = RFPApproveForm(instance=self.kwargs.get('ref_no')) return context # Add POST method def post(self, request, pk): post = RFP.objects.get(ref_no=self.kwargs['pk']) form = RFPApproveForm(request.POST) if form.is_valid(): obj = form.save(commit=False) obj.post = post obj.current_approver = self.request.user obj.save() return redirect('home-page') -
no circles with addSource + addLayer in MapBox
I am trying to insert a simple map with circles indiating the location of various datapoints. I have been using mapbox to do this with a geojson file, but nothing is displaying in the map. I don't get any errors either and all the data seems to load appropriately, so I am puzzled as to what I should try next. I am running this in combination with django, so my current code looks like: <div id="map"></div> <script > mapboxgl.accessToken = 'token'; var map = new mapboxgl.Map({ container: 'map', // container id style: 'mapbox://styles/sam-bristol/ckajw2ywz2aik1itka7vmgfbh', // stylesheet location center: [90, 0], // starting position [lng, lat] zoom: 1.5 // starting zoom }); var coordinates = JSON.parse("{{latlong|escapejs}}") map.on('load', function() { // add data source to hold our data we want to display map.addSource('circleData', { type: 'geojson', data: { type: 'FeatureCollection', features: [coordinates], }, }); map.addLayer({ 'id': 'data', 'type': 'circle', 'source': 'circleData', 'paint': { // make circles larger as the user zooms from z12 to z22 'circle-radius': { 'base': 1.75, 'stops': [ [12, 2], [22, 180] ] }, } }); }); </script> Currently the map displays properly, but no circles are being plotted - which I would expect to come out of the addLayer … -
How can i use matplotlib, bokeh libraries in django?
I have gone through lot of stuff online but did not come across any proper documentation related to django+bokeh or django+matplotlib integration.Please help. -
Django WebApp configuration on CentOS7 using Apache mod_wsgi
I have developed a simple website using python django web framework. I am trying to deploy my website on apache mod_wsgi, but it is throwing 500 Internal server error. My project environment details are here. Python version: Python 3.6.8 Django version: 3.0.5 Database: mysql Ver 14.14 Distrib 5.7.30 Operating system: CentOS7 HTTPD version: Apache/2.4.6 (CentOS) My Apache configuration file is below. <VirtualHost *:80> ServerName 192.168.25.128 ServerAlias nwaytech.co.in Alias /favicon.ico /opt/pydjwebpro/nwayapp/static/images/favicon.ico Alias /media/ /opt/pydjwebpro/nwayapp/media/ Alias /static/ /opt/pydjwebpro/nwayapp/static/ Alias /static/ /opt/pydjwebpro/nwayapp/temlpates/ <Directory /opt/pydjwebpro/nwayapp/templates> Require all granted </Directory> <Directory /opt/pydjwebpro/nwayapp/static> Require all granted </Directory> <Directory /opt/pydjwebpro/nwayapp/media> Require all granted </Directory> WSGIScriptAlias / /opt/pydjwebpro/nwayapp/nwayapp/wsgi.py WSGIDaemonProcess nwayapp python-home=/opt/pydjwebpro/ python-path= /opt/pydjwebpro/lib/python3.6/site-packages WSGIProcessGroup nwayapp <Directory /opt/pydjwebpro/nwayapp/nwayapp/> <Files wsgi.py> Require all granted </Files> </Directory> </VirtualHost> I have installed mod_wsgi using pip in my virtual environment, I have to install httpd-devel packages. Could you anyone help, Please. Thanks in advance. -
How to modify Unique and ForeignKey for Django ModelForm
I have the following code: By default User model set username as Unique and Foreign Key, how to set email as unique and foreign key instead? class UserForm(UserCreationForm): class Meta: model = User fields = ['username', 'email', 'password'] widgets = { 'username': forms.TextInput(), 'email': forms.EmailInput(), } Best Regards, -
Running migrate on postgresql db is attempting to migrate already migrated migrations
I've recently upgraded form sqlite to postgresql for my django project. In the past, whenever I've made a change to a model, I simply ran makemigrations and then the migrate command. No issues. Now, with posgresql, when I make the INITIAL makemigrations/migrate, it works fine as per usual, but if I make a change to a model and then run makemigrations and then migrate, on the 'migrate' command, the system tries to apply the initial migration again and returns an error saying the table already exist (which it does). How can I run migrate without the system trying to remigrate migrations that have already been migrated? Thanks! Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/home/jimmy/lib/python3.6/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/home/jimmy/lib/python3.6/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/jimmy/lib/python3.6/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/home/jimmy/lib/python3.6/django/core/management/base.py", line 369, in execute output = self.handle(*args, **options) File "/home/jimmy/lib/python3.6/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/home/jimmy/lib/python3.6/django/core/management/commands/migrate.py", line 233, in handle fake_initial=fake_initial, File "/home/jimmy/lib/python3.6/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/home/jimmy/lib/python3.6/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/home/jimmy/lib/python3.6/django/db/migrations/executor.py", line 245, in apply_migration state … -
using jquery-csv, always get the same error no matter which csv file i access
I have some jquery files I am using to customize Django admin. I want to draw in a code table from a local csv file using Google's jquery-csv (https://github.com/typeiii/jquery-csv) function getCodeTable() { $.ajax({ url: "admin/js/custom/Sample100.csv", aync: false, success: function (csv) { csv_as_objects = $.csv.toObjects(csv); }, dataType: "text", complete: function () { return csv_as_objects; } }); } The original csv file is created by Postgres. When I put it in my project and try to access it, I get this error: CSVDataError: Illegal quote [Row:3] Thinking that there is something wrong with the csv, I have opened it in Notepad++ to look for problems, but I see none. I have run the file through https://csvlint.io/ and it came out valid. I then downloaded their Standardized CSV of the same file. When I opened it and looked at it, the only changes it made where to put quotes around the primary keys. I put that in my project and ran, and came back with the same error: CSVDataError: Illegal quote [Row:3] I thought Postgres is giving me some badly formatted csv file somehow, so I went to this site https://www.appsloveworld.com/sample-csv-file/ and downloaded a csv file named Sample100.csv to see how that works. … -
Use django admin to save to different data tables based on user roles
I am using django to build a cms system and want to implement the audit function by uploading ordinary users content to transit table. Overwriting save model does not work because there are some inline tables. And I have a doubt, when the admin class is registered with model, can it save the data(obj) to other model? -
i have a error "upstream prematurely closed connection while reading response header from upstream"
Please help me I am using django , nginx , uwsgi Several attempts have been made, but all have failed. What is the problem? I will attach the configuration file below. uwsgi.ini [uwsgi] chdir = /home/vagrant/workspace/management socket = 127.0.0.1:8003 chmod-socket = 666 home = /home/vagrant/workspace/management venv = /home/vagrant/workspace/management/venv/ buffer-size=32768 master = true processes = 3 threads = 2 wsgi-file = /home/vagrant/workspace/management/management/wsgi.py vhost = true logto = /home/vagrant/workspace/management/uwsgi.log nginx setting upstream django { server localhost:8003 fail_timeout=0; } server { listen 80; charset utf-8; server_name admin.*; fastcgi_buffers 8 16k; proxy_request_buffering off; proxy_buffering off; proxy_read_timeout 300; proxy_connect_timeout 300; client_max_body_size 75M; # adjust to taste location /common { alias /home/vagrant/workspace/.static_root; } location / { uwsgi_pass django; include /home/vagrant/workspace/management/uwsgi_params; } } nginx.log 2020/05/24 18:01:59 [error] 17214#17214: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.33.1, server: admin.*, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://127.0.0.1:8003", host: "admin.dev.kr", referrer: "http://admin.dev.kr/course/admin/crm/list" help me...