Category "django"

How to stop gunicorn properly

I'm starting gunicorn with the Django command python manage.py run_gunicorn. How can I stop gunicorn properly? Note: I have a semi-automated server deployment

how to compare only date from a model's datetimefield with current date?

I want to use Model.objects.filter(datetime_lte=datetime.datetime.now.date()) How exactly can I achieve this? I am using django 1.6.5. I want only records of cu

django test app error - Got an error creating the test database: permission denied to create database

When I try to test any app with command (I noticed it when I tried to deploy myproject using fabric, which uses this command): python manage.py test appname

fakeredis between multiple django views

I have a test which involve multiple Django views It seems that the fakeredis isn't shared between multiple views I tried running the following code: import f

Amazon Elastic Beanstalk not serving django static files

I am trying to put up a simple django app on elastic beanstalk. I thought I had the static parts of the app figured out as it works with heroku and on a server

Generating a Random Hex Color in Python

For a Django App, each "member" is assigned a color to help identify them. Their color is stored in the database and then printed/copied into the HTML when it i

Django: ImportError, No module named urls

I have the following urls.py file in my project directory: from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodisco

Django: serving static file on debug=false

I know this question was asked many times, but none of the answers i found and tried helped me. Those are my static files settings: STATIC_ROOT = os.path.absp

gunicorn shows connection error [Errno 111]

Hi im building a Django app with docker, gunicorn and nginx and having serious issues calling a post request from the django view. my login function - with sch

Conditional unique_together in Django

I have following unique constraint in my model. class Meta: unique_together = (('crop', 'order', 'sku'),) But sku may be null in some cases and in th

How to get Request.User in Django-Rest-Framework serializer?

I've tried something like this, it does not work. class PostSerializer(serializers.ModelSerializer): class Meta: model = Post def save(self)

If "null=True", which is stored in DB "NULL" or "empty values"?

I created the django model "User" with "null=True" as shown below: # "myapp/models.py" from django.db import models class User(models.Model):

Django Import Error: No module named apps

I just checked out a project with git. The project structure is project apps myapp settings __init__.py __init__.py manage.py

Django: Search form in Class Based ListView

I am trying to realize a Class Based ListView which displays a selection of a table set. If the site is requested the first time, the dataset should be displaye

Override existing Django Template Tags

Is it possible to override an existing Django Template Tag or is it necessary to customize the template file and create a new Template Tag?

AuthAlreadyAssociated Exception in Django Social Auth

After I create a user using say Facebook(let's say fbuser) or Google(googleuser). If I create another user through the normal django admin(normaluser), and try

HttpResponseRedirect Reverse not working Django

I am trying to redirect my page after submitting a like button to the same page but I keep getting a NoReverseMatch at /score/like/2 Here is the urls urlpa

Django - run a function every x seconds

I'm working on a Django app. I have an API endpoint, which if requested, must carry out a function that must be repeated a few times (until a certain condition

Django static Files not loaded on Docker?

I am using Django 3.0.6 and want to dockerize my project. everything is worked fine except static files. Static files are loaded completely when I run my projec

What does blue-colored text mean in the terminal output from the Django development server?

Sometimes the lines after each normal terminal-green colored line like '[24/Sep/2012 00:42:30] "GET / HTTP/1.1" 200 1904' are my normal terminal-green color, an