Tagged Questions
1
vote
2answers
26 views
Long running django transaction integrity error
How should we make long-running transaction "integrity error" free while using Django? (especially foreignkey integrity error)
Our application has entity 'A' and 'B' (for the sake of simplicity)
...
5
votes
2answers
42 views
Should I include SELECTs in a transaction?
When using a database transaction to group multiple updates, should I include SELECTs inside the transaction as well? For instance, lets say I:
get a record
check edit permissions for that record, ...
0
votes
0answers
32 views
Restarting postgresql gives error in ubuntu
When I run this command I get the following error:
postgres@ri-desktop:~$ psql psql: could not connect to server: No
such file or directory Is the server running locally and
accepting ...
1
vote
3answers
112 views
Installing Django, PostgreSQL on Google Compute Engine Debian 7 Instance
I am trying to deploy a Django application on Google Compute Engine. I'm using a Debian 7 image and want to set up Django with Nginx, Gunicorn, virtualenv, supervisor and PostgreSQL. I have everything ...
2
votes
1answer
38 views
django: Proper way to recover from IntegrityError
What's the proper way to recover from an IntegrityError, or any other errors that could leave my transactions screwed up without using manual transaction control?
In my application, I'm running into ...
0
votes
1answer
28 views
Problems with django app DATABASES setting for heroku deployment
When I change my setting of Database according to the official guide as
DATABASES['default'] = dj_database_url.config()
It has
NameError: name 'DATABASES' is not defined
when building.
When I ...
0
votes
0answers
42 views
(Nginx + uWSGI + Django) slows down after a few days
Simply put after a few days (and thousands of requests) our web application slows down.
Our setup:
2 load-balancer servers (HAProxy) one master and one slave
4 web servers (Nginx + uWSGI + Django)
...
0
votes
1answer
26 views
Django doesn't update postgresql database
I recently switched form a SQL Lite DB to a Postgresql DB for my Django project. I was not far in, so I did no migrations and just started with a clean DB. I followed the instructions found here ...
1
vote
1answer
15 views
Inconsistent results when exporting JSON from Postgres using Django
I'm trying to create a Django view that returns JSON data from Postgres (i.e. the data from Postgres is already of the JSON type).
I use the Django dev server and Postgres in my development ...
19
votes
5answers
5k views
Why is iterating through a large Django QuerySet consuming massive amounts of memory?
The table in question contains roughly ten million rows.
for event in Event.objects.all():
print event
This causes memory usage to increase steadily to 4 GB or so, at which point the rows print ...
1
vote
1answer
30 views
How to group similarly named items?
The Problem
The stack is Django 1.6, PostgreSQL 9.3 and Elasticsearch 1.2. In PostgreSQL, I've got data in a table (most columns removed for brevity):
Activity Name ...
0
votes
1answer
9 views
Heroku Django Postgresql database admin, where is the super user?
I know it's quite newbie, but I just started using heroku. Please bear with me.
If you develop on heroku, it provides you postgresql with username and password.
However when you access it from your ...
1
vote
0answers
41 views
Django python syntax error in views.py
I recently had this issue with my web application in Django :
SyntaxError at /
invalid syntax (views.py, line 98)
Request Method: GET
Request URL: http://craft.irisa.fr/
Django Version: 1.6.5
...
0
votes
0answers
14 views
Django MultiValueDictKeyError in admin, only on update with inlines
I have seen several posts on this error in relation to < 1.6.2, however, I am running version 1.6.2 and I am seeing this, but it is ONLY happening on updates, not in inserts.
I always get a ...
0
votes
2answers
21 views
Django: ProgrammingError when dealing with ManyToMany database
Started using ManyToMany relationships in my postgresql database, but I end up with
"Programming Error : relation "sequences_sequence_access" does not exist"
can someone please explain to me my ...
2
votes
4answers
1k views
Installing PostgreSQL and pyscopg2 on Snow Leopard
I'm still a complete beginner in the field of web development and I'm trying to set up the Django environment. I'm reading "the definitive guide to django" to start my practice.
I'm running Snow ...
-1
votes
0answers
34 views
PostgreSQL does not find a relation [closed]
PostgreSQL does not find a relation . For example: I've got an application account and order, there is a model in the account of the user, in order Order model in which there is FK to the user, if use ...
0
votes
0answers
27 views
Django: Order Queryset so single record is last
I want the order of my queryset to be such that I have a single record as the last and then all other records above them ordered a different way.
For example, a models.py in an app named agency...
...
-1
votes
0answers
26 views
Linux Apache server keeps crashing [closed]
My apache server keeps crashing and I need to restart/reload it again manually. This error appears once a day. However,I see a pattern - the error times are the same (somewhere around 2'0 clock), but ...
3
votes
3answers
454 views
How can I improve this many-to-many Django ORM query and model set?
I have a Django query and some Python code that I'm trying to optimize because 1) it's ugly and it's not as performant as some SQL I could use to write it, and 2) because the hierarchical regrouping ...
1
vote
1answer
25 views
Why I cannot create a database for graphite-web?
I am trying to install graphite-web on my computer by following the instructions on
https://gist.github.com/surjikal/2777886. When I try to populate the database with manage.py syncdb it does not find ...
0
votes
1answer
25 views
Fast and efficient random queryset - Django [duplicate]
I look on some posts in SO about random queryset in Django. All i can find is that order_by('?') is not fast and efficient at all, but my experience does not tell so.
I have a table with 30.000 ...
32
votes
8answers
57k views
How to setup PostgreSQL Database in Django?
I'm new to Python and Django.
I'm configuring a Django project using PostgreSQL database engine backend, But I'm getting errors on each database operations, for example when i run manage.py syncdb, ...
0
votes
0answers
22 views
Psycopg2 installation for OS X and Django
I would like to use the PostGreSQL database with Django.
I first installed the driver psycopg2 with pip and virtualenv:
$ PATH=$PATH:/Library/PostgreSQL/9.3/bin/
$ pip install psycopg2
[...]
...
-1
votes
2answers
23 views
Django syncdb cannot find postgres View for ForeignKey relation
I'm trying to create a ForeignKey relation to a postgres view. This was originally working with a different model but now that I've created a second one it seems unable to create the new table.
The ...
0
votes
1answer
73 views
Django BigIntegerField Can Not Be Displayed With def __unicode__(self):
UPDATE #2: I found the issue is with:
def __unicode__(self):
return self.thread_id
How can I return the thread_id number for admin panel viewing with thread_id = ...
0
votes
4answers
51 views
Using Django ORM, how do I filter against two fields of the same record in a Many relationship?
I have a DB schema like so:
class Family(models.Model):
pass
class Child(models.Model):
family = models.ForeignKey(Family)
name = models.TextField()
age = models.IntegerField()
...
0
votes
1answer
35 views
How to support variable number of one-to-many relationships in database
I am trying to design a Person database. The requirement is that a Person can have one or more varying number of children, cars, jobs, and homes.
So, currently, the way I have designed this is:
...
0
votes
2answers
32 views
django form submission error (passing parameter from view.py to form)
I am a beginner to Django and Postgresql, and new to stackoverflow. Currently I am developing a web app that allows the user to create a new postgresql database, as well as connect to a existing ...
0
votes
1answer
148 views
Why can't my Django application reach my Postgres server?
Both servers are VirtualBox servers on my host machine, and I'm able to network between them just fine (ssh from one to the other, etc.), other than this issue (which I don't know enough about to rule ...
0
votes
0answers
18 views
django ORM: Tree strcuture: WITH RECURSIVE instead of mptt
I need a hierarchical tree structure in an application developed with django.
The usage of django-mptt seems to very common, but there are something problematic about it:
However, django-mptt ...
1
vote
1answer
15 views
DJANGO: FK field lookups through QuerySet exclude()
Im trying to exclude all objects from a django queryset that have a foreign key in another queryset. I am not having success using exclude() however. Please help.
Here is a snippet from the python ...
1
vote
0answers
34 views
Auto_now_add Django Weird Bug
I'm using Postgresql 9.3.4, Windows 7 64 Bit, Django 1.6.5.
I had one model (A MODEL) with one field (B FIELD) using auto_now_add. When my application add record to A MODEL, I didn't have problem in ...
2
votes
1answer
255 views
Django Heroku Postgresql ERROR: invalid byte sequence for encoding “UTF8”
I am using Django with Heroku Postgreql. I use both English and Turkish languages on default DB settings. My DB works with no issues both locally and on Heroku. However, I get an error when I try to ...
0
votes
1answer
12 views
Django DB alternative to select_for_update
In my web app, different users could be simultaneously making requests that modify different fields on the same object.
Let's say our widget object has fields a and b which are both originally 0.
...
1
vote
1answer
32 views
How to (programmaticaly or by other means) encrypt or protect customer data
I am working on a web project and I want to (as far as possible) handle user data in a way that reduces damage to the users privacy in case of someone compromising our servers/databases.
Of course we ...
0
votes
1answer
28 views
Django query formatting datetime output
My Django install uses a PostgreSQL backend.
I am doing the following in a Django view:
completedItems = Completed.objects.filter(user_id=1)
return ...
4
votes
2answers
150 views
Django Haystack-Xapian search fails with special characters and spaces
I'm working on an existing Django project which uses haystack with xapian backend for a global search feature. However the search seems to fail while I search with some special characters like & ...
0
votes
0answers
13 views
OpenPLM 1.2 does not send mail, how to debug Django sendmail
PostgreSQL 9.1 Python 2.7.3 Django 1.3.1 Celery 2.4.6 Haystack 1.2.7 Xapian 1.2.8 Lepl 5.1.1 South 0.7.3
settings.py
DEBUG = True
TEMPLATE_DEBUG = DEBUG
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
...
0
votes
1answer
38 views
Trouble with psycopg2 in virtualenv python3 for use with Django
I have a Django project that I would like to use with a PostgreSQL database but I am having an issue with psycopg2. When I try to run the dev server or perform a syncdb I get this error. My project is ...
0
votes
1answer
42 views
GeoDjango dwithin errors when using django.contrib.gis.measure.D
First off: Python 2.7.6, Django 1.6.5, Postgres 9.3.4, PostGIS 2.1.3, psycopg2 2.5.3 on RHEL 6.5
Here's the relevant model:
class Location(models.Model):
name = models.CharField(max_length=255)
...
0
votes
1answer
44 views
Django Duplicate Key Error but key does not exist
I am testing out a small app where I have extended the user model to add some additional information. Users can register via django-allauth (google OAuth2) fine, and entries are added to their ...
0
votes
1answer
23 views
Can I find and replace a string in an entire postgresql database of a Django project?
I'm looking to find and replace every instance of a certain string within a database that drives a Django project. Is there a way that I can write a management command that searches every table of the ...
0
votes
1answer
18 views
PostgreSQL and South migrations sequences
I switched from MySQL to PostgreSQL and running migrations and it is a bit strange after MySQL. When I run ./manage.py migrate on a clean db, whenever the migration comes to a field which is ...
0
votes
1answer
11 views
Django: Collecting all entries from a Foreign key model from a specific Parent Model
I am currently using this relationship to grab all images from a specific instance of the model Product
product = get_object_or_404(Product, pk=product_id)
images = product.image_set.all()
If I ...
1
vote
1answer
20 views
Django accessing reverse foreign key data in values object
I'm building an CMS for fun but I'm stuck in django when querying resources for a given post.
I have the following code doing what I want:
data = ...
0
votes
1answer
32 views
Python South not picking up changes made in add_to_class() method
I've added a field to the main Django 'User' model, by inserting a User.add_to_class() to Askbot's models.init
the added code is the following:
#askbot-devel/askbot/models/__init__.py
...
1
vote
1answer
44 views
Prevent slow INNER JOIN in Django model calls when unnecessary
Is it possible to prevent Django from using INNER JOIN in SQL relationship queries when unnecessary?
I have the two tables:
class Author(models.Model):
name = models.CharField(max_length=50, ...
1
vote
1answer
119 views
Ubuntu 14.04 + liblwgeom-2.1.1 postgres
I had a project working on my computer and I've decided to update my ubuntu to 14.04 and my project stopped working =[
I'm using python/django and postgres and I use these libs:
from ...
0
votes
0answers
40 views
What causes postgresql to mess up the sequence?
I'm fairly new to Postgresql and it's really weird for me that It can't keep track of auto increment fields.
I have these tables I'm using for my django app
Article
Article_Category
Category
...