Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django matching a url with paramater to start
In Django 3 I've got a site I'm working on where I need to match a paramater at the start of the url. So test.com/the-data-slug What is odd is I can't figure out why the following code dosen't work. It dosen't match at all. path('<slug:data-slug>/', DataLandingView.as_view(), name="data_landing") I did get the following to work, but I know path is prefered over re_path. re_path(r'^(?P<data-slug>\w+)/$', DataLandingView.as_view(), name="data_landing") I'm really curious what I'm doing wrong with the path call, or is this just something path can't do? -
DRF get only the first serialized instance for list view?
I'm working on a real estate app and want the listings to show only the first image of the Listing. Currently it is showing all images. class Image(models.Model): photo = models.ImageField(blank=True, upload_to=get_image_filename) listing = models.ForeignKey(Listing, on_delete=models.CASCADE) class ImageSerializerForListingList(serializers.ModelSerializer): photo = serializers.ImageField() class Meta: model = Image fields = ('photo', ) class ListingListSerializer(serializers.HyperlinkedModelSerializer): image = ImageSerializerForListingList(many=True, required=False, source='image_set') class Meta: model = Listing fields = ('url', 'address', 'image', ) def get_first_image(self, obj): image = obj.image_set.all().first() return ImageSerializerForListingList(image, many=True).data This is still showing all images, Any advice on this? -
Unable to connect Django Rest framework application with GCP cloud SQL
I created a could SQL instance on GCP for MySql 5.7. I am trying to connect it with Django Rest framework application. I am also using Docker to containerize Django application. I am running Django application on localhost but for MySql I want to use GCP cloud Sql. I got the public IP address of the cloud Sql instance once it was up and running. Then I created a database eitan_database with user jeet and password root. In Django project's settings.py file I updated the database settings as following - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'eitan_database', 'USER': 'jeet', 'PASSWORD': 'root', 'HOST': '35.239.xxx.x', 'PORT': 3306, } } I have used public IP for HOST and for PORT Mysql default 3306. I don't understand what is wrong with the database configuration but when I run server I get the following error. Traceback (most recent call last): eitan-application_1 | File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection eitan-application_1 | self.connect() eitan-application_1 | File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 24, in inner eitan-application_1 | return func(*args, **kwargs) eitan-application_1 | File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 197, in connect eitan-application_1 | self.connection = self.get_new_connection(conn_params) eitan-application_1 | File "/usr/local/lib/python3.7/site-packages/django/utils/asyncio.py", line 24, in inner eitan-application_1 | return func(*args, **kwargs) eitan-application_1 | File … -
Download button with function, react
I am using Django and react to make a website. I want to be able to download a websitepost, locally on my computer as a website user. <button className={styles.button} onClick={() => {}}> </button>` How do i finish this button? And what functionality am I missing? -
Accessing localhost not possible on MacOS
my situation is that the website I'm building has a landing page the main App page and the API section. They are respectively reachable with [domain_name], app.[domain_name] and api.[domain_name]. When calling those I don't have any problems reaching them in any browser. When I host them however in my local environment then api.localhost does only work when I call it with Postman. When I try to ping the api.localhost it only says: ping: cannot resolve api.localhost: Unknown host On other systems, this will get a response. In terms of Django Cors stuff, it all seems to be managed correctly as it is working on other systems. But I can add any code if asked for such, just don't want to add everything that I can think of from the Django project. I have no idea what to try or what to change so any help would be beneficial. -
How can form fields be rendered manually in django-bootstrap-datepicker-plus
I have django-bootstrap-datepicker-plus set up in my app. Upon completion, I noticed that my form fields are stacked on rows screenshot whereas I would love to manually render some of the fields on the same row. Although I know the reason for that is because the form is rendered using {% bootstrap_form form %} Here is my rendered template code snippet below. {% extends 'accounts/no_header_footer.html' %} {% block content %} {% load bootstrap4 %} {% bootstrap_css %} {% bootstrap_javascript jquery='full' %} {{ form.media }} <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script> <div class="profile-create-form-container"> <form class="profile-create-form" data-certificates-url="{% url 'ajax_load_certificates' %}" data-grades-url="{% url 'ajax_load_grades' %}" data-relationships-url="{% url 'ajax_load_relationships' %}" data-states-url="{% url 'ajax_load_states' %}" enctype="multipart/form-data" id="ProfileCreateForm" method="POST" runat="server"> {% csrf_token %} <fieldset class="form-group text-center"> <span class="navbar-brand"> <img alt="..." height="40px" src="..." width="40px"> Basic Information </span> </fieldset> {% bootstrap_form form %} <div class="container"> <div class="text-center"> <button class="btn btn-dark" type="submit"> <i class="fa fa-save"></i> Save and Continue </button> </div> </div> </form> </div> The question I have is, is it possible to render each form field manually? -
Cannot get Foreignkey Model to Save to Sqlite Database with Django
I have looked over every article on everything that has ever been posted and none of the resolutions seem to fix my issues. I can't seem to get input from my view to save to my database. Theoretically the user will input a contact and business and the contact will associate with the business and the contact will be added however I am like 99% sure I am wrong somewhere, I am just 100% sure I don't know where: Models from django.db import models class Business(models.Model): business_name = models.CharField(max_length=30, unique=True) date_created = models.DateField(auto_now=True) def __str__(self): return self.business_name class Contact(models.Model): name = models.CharField(max_length=30) title = models.CharField(max_length=30) number = models.CharField(max_length=13) email = models.EmailField() business = models.ForeignKey(Business, on_delete=models.CASCADE) def __str__(self): return "%s - %s" % (self.name, self.business) Forms from django import forms from .models import Contact, Business class ContactForm(forms.ModelForm): def __init__(self, business, *args, **kwargs ): super(ContactForm, self).__init__(business, *args, **kwargs) self.fields['business'].queryset = forms.ModelMultipleChoiceField(queryset=business) class Meta: model = Contact fields = ['name', 'title', 'number', 'email', 'business'] class BusinessForm(forms.ModelForm): class Meta: model = Business fields = ['business_name'] Views def add_contact(request): all_contacts = Contact.objects.all if request.method == "POST": business = get_object_or_404(Business, business_name=request.POST['business']) form = ContactForm(request.POST, instance=business) # print(form) if form.is_valid(): new_form = form.save(commit=False) new_form.business = form.business print(new_form) … -
ValueError at /admin/listings/listing/add/
Invalid format string Request Method: POST Request URL: http://localhost:8000/admin/listings/listing/add/ Django Version: 3.0.4 Exception Type: ValueError Exception Value: Invalid format string Exception Location: C:\Users\Ayesha Siddiqha\btre_project\venv\lib\site-packages\django\db\models\fields\files.py in generate_filename, line 305 Python Executable: C:\Users\Ayesha Siddiqha\btre_project\venv\Scripts\python.exe Python Version: 3.8.2 Python Path: ['C:\Users\Ayesha Siddiqha\btre_project', 'C:\Users\Ayesha ' 'Siddiqha\AppData\Local\Programs\Python\Python38-32\python38.zip', 'C:\Users\Ayesha ' 'Siddiqha\AppData\Local\Programs\Python\Python38-32\DLLs', 'C:\Users\Ayesha ' 'Siddiqha\AppData\Local\Programs\Python\Python38-32\lib', 'C:\Users\Ayesha Siddiqha\AppData\Local\Programs\Python\Python38-32', 'C:\Users\Ayesha Siddiqha\btre_project\venv', 'C:\Users\Ayesha Siddiqha\btre_project\venv\lib\site-packages'] -
Unable to host django on IIS using Fast CGI (wfastcgi). Getting 500 error in browser
I am unable to host a basic django project in IIS. I have been breaking my head over 2 days now and help would be greeeaaatly appreciated :). I have enabled IIS, CGI, and others under the Application Development in IIS. This is my folder structure after creating a simple django project via the below command: django-admin startproject dijky Folder structure: + C:\inetpub\wwwroot + dijky + dijky - __init__.py - settings.py - urls.py - wsgi.py - manage.py - web.config - wfastcgi.py I have copied the wfastcgi.py file into my project folder. I have then Added a website named "dijky" with the below settings Under the Machine name in IIS, Clicked on FastCGI Settings, and have given the Full path and Arguments as so: Then gave the environment variables as: I even tried setting the WSGI_HANDLER to dijky.wsgi.application, since the file C:\inetpub\wwwroot\dijky\dijky\wsgi.py has: import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dijky.settings") application = get_wsgi_application() Both don't work My web.config XML file is: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="djangoappiis" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\xxxxxxx\Anaconda3\envs\djangy\python.exe|C:\inetpub\wwwroot\dijky\wfastcgi.py" resourceType="Unspecified" /> </handlers> </system.webServer> <appSettings> <!-- Required settings --> <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" /> <add key="PYTHONPATH" value="C:\inetpub\wwwroot\dijky" /> <add key="DJANGO_SETTINGS_MODULE" value="dijky.settings" /> </appSettings> </configuration> After Starting the server … -
Create a field with grouped attributes from the model in DRF
I want to group a specific attributes from a model instead of serializing them individually more or less like this class MyModel(models.Model): attr1 = models.IntegerField() attr2 = models.IntegerField() attr3 = models.CharField() and serialize will output this { # other attrs "grouped_attrs" : {"attr1": 23, "attr2": 848, "attr3": "foo"} # other attrs } -
Server Connection Refused - Django/Postgresql
I want to preface that everything works on my other computer but with the new macbook I got, I am trying to determine the cause of the issue. The issue is when attempting to run python manage.py runserver with my Django project with PostgreSQL. I have made sure to install all my node modules and dependencies, I have re-installed PostgreSQL using homebrew and have started my postgres. waiting for server to start....2020-03-11 13:49:40.157 EDT [88879] LOG: starting PostgreSQL 12.2 on x86_64-apple-darwin18.7.0, compiled by Apple clang version 11.0.0 (clang-1100.0.33.17), 64-bit 2020-03-11 13:49:40.159 EDT [88879] LOG: listening on IPv6 address "::1", port 5432 2020-03-11 13:49:40.159 EDT [88879] LOG: listening on IPv4 address "127.0.0.1", port 5432 2020-03-11 13:49:40.160 EDT [88879] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-03-11 13:49:40.168 EDT [88880] LOG: database system was shut down at 2020-03-11 13:45:10 EDT 2020-03-11 13:49:40.171 EDT [88879] LOG: database system is ready to accept connections done server started But for whatever reason, I get the following: Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). Exception in thread django-main-thread: Traceback (most recent call last): File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection self.connect() File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner return func(*args, … -
Mobile screen size alias links not working
ROBLEM: In Mobile screen size alias links are not working Description I have built a project (HTML, CSS, JS building tool) with https://bootstrapshuffle.com/ I have exported the project Put it in to a django project I have added a few extra buttons to the middle of the screen that are fusions as alias on the landing page. ERORR: This exported project perfectly works with all the buttons when it is in Desktop screen size or tablet screen size (both cases the original builder reorganizes the components). But when I shrink the screen size to the size of a mobile and it reorganizes the components it leaves these alias buttons that worked in both tablet and desktop mode but does not in this mobile screen size. I have read the following projects and I probably have something similar Href links do not transpire/work at mobile size screen media queries not working on mobile screen size Links not working on site when screen size is reduced The only issue is that I have that the downloaded project from the online editor only given me a bootstrap.min.css and bootstrap.min.css.map non of them is organized. Is there a way to make them organized and … -
Django Rest Framework drf-nested-routers example of Infinite-depth Nesting and Hyperlinks for Nested resources
I am quite new to django-rest-framework. I am trying to combine the examples infinite-depth nesting and hyperlinks for nested resources in drf-nested-routers I added a MailReply object just to try the infinite-depth nesting. My infinite-depth nesting works fine but i am getting confused by the nesting serializer relations. models.py from django.db import models class Client(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class MailDrop(models.Model): title = models.CharField(max_length=100) client = models.ForeignKey('Client', on_delete=models.CASCADE, related_name='maildrops') def __str__(self): return self.title class MailRecipient(models.Model): name = models.CharField(max_length=100) mail_drop = models.ForeignKey('MailDrop', on_delete=models.CASCADE, related_name='mailrecipients') def __str__(self): return self.name class MailReply(models.Model): title = models.CharField(max_length=100) mail_recipient = models.ForeignKey('MailRecipient', on_delete=models.CASCADE, related_name='mailreplies') def __str__(self): return self.title I want to show the url of my objects like this, it's working but currently it's missing the url { "id": 1, "url": "/api/clients/2/" "name": "Client Name 1", "maildrops": [ { "title": "Mail Drop Title 1" } ] }, { "id": 2, "url": "/api/clients/2/" "name": "Client Name 2", "maildrops": [ { "title": "Mail Drop Title 2" } ] } I tried using NestedHyperlinkedModelSerializer instead of HyperlinkedModelSerializer in my custom serializers like what was suggested in the example for hyperlinks for nested resources both works. Also tried NestedHyperlinkedRelatedField instead of HyperlinkedRelatedField but like before it does the … -
Django app to perform Matrix operations [Beginner]
Design of the app. Click Here How can I make an app designed like this with Django? Please be detailed about the forms and I want the output to be displayed on the same page. -
cart added but is charged twice when checkout
I am having some issues with cart payment with stripe. When I checkout one product it is checking out two orders (no matter how many products I have within the cart). Here is the function I have to create a cart in session and error: from django.shortcuts import get_object_or_404 from tour_store.models import Destinations def cart_contents(request): """ Ensures that the cart contents are available when rendering every page """ cart = request.session.get('cart', {}) cart_items = [] total = 0 destination_count = 0 for id, quantity in cart.items(): destination = get_object_or_404(Destinations, pk=id) total += quantity * destination.price destination_count += quantity cart_items.append({'id': id, 'quantity': quantity, 'destination': destination}) #cart_item will loop into the cart. print(cart_items) print(destination_count) print(cart) return {'cart_items': cart_items, 'total': total, 'destination_count': destination_count} =====SHELL=============== {'1': 1} << NORMAL CART ADDED [11/Mar/2020 16:27:38] "GET /chekout/ HTTP/1.1" 200 12919 {'1': 1}. << DOUBLE THE CART AND CHARGE {'1': 1} [11/Mar/2020 16:28:59] "POST /chekout/ HTTP/1.1" 302 0 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 54962) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 650, in process_request_thread self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 720, in __init__ self.handle() File "/Users/macbook/software_projects/tour_project/venv/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 174, in handle self.handle_one_request() File "/Users/macbook/software_projects/tour_project/venv/lib/python3.8/site-packages/django/core/servers/basehttp.py", line … -
authentication problem with django and apache wsgi
I want to have a base authentication into my django application by apache's base auth. my config looks like this: <IfModule mod_ssl.c> <VirtualHost *:443> ServerName url.test.com ServerAdmin webmaster@localhost.com ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000/ WSGIDaemonProcess projectname \ python-home=/home/user/app/project/env \ python-path=/home/user/app/project:/home/user/app/project/env/lib/python3.5/site-packages/ WSGIProcessGroup projectname WSGIScriptAlias / /home/user/app/project/app/server/wsgi.py WSGIPassAuthorization On Alias /static/ /home/user/app/app/project/static/ ErrorLog ${APACHE_LOG_DIR}/error-log CustomLog ${APACHE_LOG_DIR}/access-log combined LogLevel info # Protecting with basic authentication <Location /> AuthType Basic AuthName "Restricted Content" AuthUserFile /etc/apache2/.htpasswd Require user testuser AuthBasicProvider wsgi WSGIAuthUserScript /home/user/app/project/app/server/wsgi.py </Location> SSLCertificateFile /etc/letsencrypt/live/project.app.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/project.app.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> and wsgi.py containing: import os import sys sys.path.insert(0, '/home/user/app/project') sys.path.append('/home/user/app/project/env/lib/python3.5/site-packages') os.environ["DJANGO_SETTINGS_MODULE"] = "project.app.settings" from django.core.wsgi import get_wsgi_application application = get_wsgi_application() with this setup I get the error message: AH01618: user testuser not found: / after some research I've seen that I probably should remove AuthBasicProvider and WSGIAuthUserScript from Location to: # Protecting with basic authentication <Location /> AuthType Basic AuthName "Restricted Content" AuthUserFile /etc/apache2/.htpasswd Require user testuser </Location> this leads to the password being accepted, but then I get a 403 error in the django application: Forbidden: / [11/Mar/2020 17:23:35] "GET / HTTP/1.1" 403 13 as I'm usually more on the coding side I'm not super familiar with the setup of the django application … -
When does Django load the apps?
While messing around with signals I discovered that Django does not load the apps until some point after __init__.py runs. When does Django load the apps? Here is the code that led me here: __init__.py import imt_prod.signals signals.py from django.contrib.auth.signals import user_logged_in # This produces 'django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.' from imt_prod.models import LoginHistory def recordLogon(sender, user, request, **kwargs): from imt_prod.models import LoginHistory # This does not LoginHistory(User=user) user_logged_in.connect(recordLogon) models.py from django.contrib.auth.models import User from django.db import models class LoginHistory(models.Model): User = models.OneToOneField(User, null=False, blank=False, on_delete=models.SET("USER DELETED"), verbose_name="User") date = models.DateField(default=date.today, null=False, blank=False, verbose_name="Logon Date") -
Django : Can we send multiple POST requests using for loop in Django?
I am trying to send multiple POST requests using for-loop in Django, but the POST request work fine only for the first iteration, and for other iterations it gives 302 error. In the image below, a user can approve the project by checking the checkbox, however it works for 'MealBox' project and when someone tries to approve another project, he cannot do that and server gives 302 error. [![enter image description here][1]][1] views.py : @login_required def project_approval_by_mentor(request): faculty = FacultyInfo.objects.get(user = request.user) group = GroupInfo.objects.filter(mentor = faculty) my_project = [] for i in group: approved = False project = Project.objects.get(group =i) my_project.append(project) for i in group: approved = False project = Project.objects.get(group =i) if request.method == "POST": project_approval_by_mentor_form = ProjectApprovalByMentorForm(request.POST,instance = project) if project_approval_by_mentor_form.is_valid(): is_approved_by_mentor = project_approval_by_mentor_form.cleaned_data.get('is_approved_by_mentor') project.is_approved_by_mentor = is_approved_by_mentor project.save() approved = True return redirect("") else: return HttpResponse("NO response") else: project_approval_by_mentor_form = ProjectApprovalByMentorForm(instance = project) return render(request,'project_approval.html',{'my_project':my_project,'project_approval_by_mentor_form':project_approval_by_mentor_form}) template for the above views.py project_approval.html : {% block content %} <div align='center' class="container"> <br> {% if user.is_authenticated and not hod%} {% for project in my_project %} <form class="form-group" method="post"> {% csrf_token %} <h1>{{project.title}}</h1> <b><i>{{project.description}}</i></b> <br> {% if not project_approval_by_mentor_form %} <p>{{project_approval_by_mentor_form.as_p}}</p> <br> <input class=" btn btn-outline-success" type="submit" name="" value="Approve"> {% else … -
Django-password-reset logic
I got this error when I was trying to modify settings.py for password reset functionality for my website EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = os.environ.get('EMAIL_USER') EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS') -
Does memcache need to be started as a daemon separately when used with django?
I am trying to integrate caching with my django project. After some research I am convinced memcache is best for this. So, I require to install memcache through apt-get memcache and then its python bindings again as another apt-get python-memcache. Then, I need to include in settings.py: CACHES = { 'default':{ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1;11211', } } My question is, all the tutorials follow upto this step. Is the above enough for setting up the cache? Do I need to do something to start memcache when running the project? If so, can I start memcache with python manage.py runserver command? -
One-To-Many Relationship Django
I am coding up a dictionary using Django. I want a word to have multiple definitions, if necessary. This would be a one-to-many relationship, but Django does not seem to have a OneToManyField. This is a snippet of my code: class Definition(models.Model): definition = models.CharField(max_length=64) class Word(models.Model): word = models.CharField(max_length=64, unique=True) definitions = models.ForeignKey(Definition, on_delete=models.CASCADE, related_name="word") I would like to do word.definitions and get back all the definitions of that word. Also, deleting a word should delete all definitions of that word. Finally, a_definition.word should give me the word associated with that definition. Help? -
Getiing this error-__init__() got an unexpected keyword argument 'instance'
im using a non-model based form django. once i get the data,i create a model object. but when im trying to edit my post(a blog/quote based app),im not able to create a form object using the model object for a specific post. these are my codes: views.py: def quote_form(request): if request.method=='POST': form=Quote(request.POST) if form.is_valid(): quote=form.cleaned_data['quote'] author=form.cleaned_data['author'] popularity=form.cleaned_data['popularity'] category=form.cleaned_data['category'] p=Quote1(quote=quote, author=author, popularity=popularity, category=category) p.save() return redirect("quote_list") else: form=Quote() return render(request,'quote/form.html',{'form':form}) def quote_edit(request, pk): q = get_object_or_404(Quote1, pk=pk) if request.method == "POST": form = Quote(request.POST,instance=q) if form.is_valid(): q = form.save(commit=False) q.author = request.user q.save() return redirect('quote_detail', pk=q.pk) #return render(request,"blog/post_detail.html",{'post':post}) else: form = Quote(instance=q) return render(request, 'quote/quote_edit.html', {'form': form}) models.py: class Quote1(models.Model): quote=models.CharField(max_length=200) author=models.CharField(max_length=200) popularity=models.IntegerField() category=models.CharField(max_length=40) forms.py: class Quote(forms.Form): quote=forms.CharField() author=forms.CharField() popularity=forms.IntegerField() category=forms.ChoiceField(choices=[('life','life'),('happiness','happiness'),('love','love'),('truth','truth'), ('inspiration','inspiration'),('humor','humor'),('philosophy','philosophy'),('science','science')]) -
Django on IIS: Debugging IIS Error due to FastCGI request timeout on large file upload
I'm trying to host a Django web application on a windows 10 machine with IIS 10 with FastCGI. Whilst everything is running good so far, I'm running into problems with certain POST-requests while uploading larger files (~120MB), namely an HTTP 500 Error. I'm at a point where I don't know how to debug any further. I resolved the Error "413.1 - Request Entity Too Large" by increasing the request limits. However, now I get an HTTP-error stating the following: C:\Apps\Python3\python.exe - The FastCGI process exceeded configured request timeout The timeout is set to 90 seconds, and I can tell that after the uploading of files completes, my browser is waiting about that time for a response from the server. There are not that much operations to perform within the Django-view for responding to the request. If I run the django developement server on the same machine, the response is beeing send justs seconds after the files were uploaded. The duration, the IIS takes to send the HTTP 500 response, takes more than 1 minute longer. I added some code to the Django-view in the post()-method to write something to a file whenever the method is called: def post(self, request, *args, … -
Django for desktop apps
I'm writing a desktop app with python. It's a client side. Can i use django framework for server side or are there any other frameworks that allow to develop servers for desktop apps? How can i send data to the server? I need to have an auth form, sessions perhaps and connection to mysql. Thanks for answers -
Modified “SM2+” Algorithm for Flashcard App Rating
I don’t know how to modify code for my adaptation of a flashcard app that uses an old algorithm to return flashcard data based on easiness rather than difficulty level, which returns a more precise result. According to the authors, the arguments should be changed as follows. The full calculation is displayed at the link below. I need your help in transforming the code to reflect the new algorithm. The Modified “SM2+” Algorithm http://www.blueraja.com/blog/477/a-better-spaced-repetition-learning-algorithm-sm2 Here is the new algorithm, with all the above improvements in place. For each review-item, store the following data: • difficulty:float – How difficult the item is, from [0.0, 1.0]. Defaults to 0.3 (if the software has no way of determining a better default for an item) • daysBetweenReviews:float – How many days should occur between review attempts for this item • dateLastReviewed:datetime – The last time this item was reviewed When the user wants to review items, choose the top 10~20 items, ordered descending by percentageOverdue (defined below), discarding items reviewed in the past 8 or so hours. After an item is attempted, choose a performanceRating from [0.0, 1.0], with 1.0 being the best. Set a cutoff point for the answer being “correct” (default is …