Category "django"

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used. Traceback (most recent call las

Django The 'image' attribute has no file associated with it

When a user registers for my app.I receive this error when he reaches the profile page. The 'image' attribute has no file associated with it. Exception Type: V

Django: How can I check the last activity time of user if user didn't log out?

django's User model has a last_login field, which is great if all the users were to log out each time they leave the site, but what if they don't? How can I tr

Saving a zipfile into directory using django

I am trying to save the zip file into one directory on my server. First, I am uploading a zip file using form and in python, I want to save it in one directory

Django: Keeping setUpTestData DRY

I've been really enjoying the convenience of setUpTestData and --keepdb in Django 1.8! However, I am running into an issue keeping data consistent across multi

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?