I installed jython, django on my windows system. I successfully created a project mysite. Now after updating settings in settings.py. i ran 'manage.py' and got the error- Import error - "no module named mysqldb".
now, i downloaded mysqldb (which is for python, but i thought it will work for jython also) and i tried to install it. but now...
Hello,
I am using django-registration version 0.8
I use the default django-registration and Django auth system without any tweak. I did notice a small glitch, once I log in as a user, if I go to the /accounts/login/ , I still get the login entry form, how can I change that it redirect a logged in user to the main root url / instead of...
Using the distance logic from this SO post, I'm getting back a properly-filtered set of objects with this code:
class LocationManager(models.Manager):
def nearby_locations(self, latitude, longitude, radius, max_results=100, use_miles=True):
if use_miles:
distance_unit = 3959
else:
distance_uni...
Hi!
i'm developing a authentication backend with object-based permissions for my django-app.I use generic relations between an object and a permission:
class GroupPermission(models.Model):
content_t= models.ForeignKey(ContentType,related_name='g_content_t')
object_id = models.PositiveIntegerField()
content_object = generic.G...
I am using Django to handle fairly long http post requests and I am wondering if my setup has some limitations when I received many requests at the same time.
lighttpd.conf fcgi:
fastcgi.server = (
"a.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "127.0.0.1",
"port" => 303...
Hello! I want to implement user registration using capctha in Django.
The workflow of django-registration app is a great, but it doesn't have captcha=(
What captcha would you recommend to use with it?
Maybe, some other variants of registration+captcha or useful links on the topic?
Oh, and this should work with Django-1.1 and don't be ...
Using django-multilingual and localeurl.
Small sample of my main page view:
def main(request): #View for http://www.mysite.com/
name = Dog.objects.all()[0].full_name #this is a translated field
return render_to_response("home.html", {"name" : name})
Entering http://www.mysite.com/ redirects me to http://www.mysite.com/ru/ and...
How do I do this:
{% if thestring %}
{% if thestring.find("1") >= 0 %}
{% endif %}
{% endif %}
I am assuming I need to build a template filter? Will that work?
...
Hello, I have these models:
def Foo(Models.model):
size = models.IntegerField()
....some other vars...
def is_active(self):
if ...checks something here...
return True
else:
return False
def Bar(Models.model):
foo = models.ForeignKey("Foo")
....some other vars...
Now...
I'd like to store uploaded files into a specific directory that depends on the URI of the POST request. Perhaps, I'd also like to rename the file to something fixed (the name of the file input for example) so I have an easy way to grep the file system, etc. and also to avoid possible security problems.
What's the preferred way to do th...
I have a html file ('search.html') with a form on it. I have saved it to ~/Django/Templates just for the sake of argument. The Django book said it doesn't matter where I save it, because the framework will find it. Anyway, I have set up a function in the views.py file to render this file. Here it is:
from django.http import HttpResponse...
I'm reading http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode but it seems like way too much work, I've been restarting my apache2 server gracefully whenever I make tweaks to Django code as it inconsistently picks up the right files and probably tries to rely on cached .pycs.
...
I'm using mr.developer to track some packages on github. When I rerun my buildout, I get:
The package 'django-quoteme' is dirty.
Do you want to update it anyway? [yes/No/all] y
What is meant by "dirty" exactly?
...
I really love working with Django and Python, when I go back to PHP I feel lugered/restricted... I tried Zend/Kohana/CodeIgniter/CakePHP but none of them are really as nice...
Does anyone know of some php framework that's heavily influenced by Django? Or at least the templating system?
...
I am trying to have a Django script run every 5 minutes via cron on my dev laptop (Mac OS X). Here is the code in the script:
import sys
import os
def setup_environment():
pathname = os.path.dirname(sys.argv[0])
sys.path.append(os.path.abspath(pathname))
sys.path.append(os.path.normpath(os.path.join(os.path.abspath(pathname...
I'm using Django 1.1 with MySQL as the database.
I have a model similar to the following:
class Review(models.Model):
venue = models.ForeignKey(Venue, db_index=True)
review = models.TextField()
datetime_created = models.DateTimeField(default=datetime.now)
I'd like to query the database to get the total number of reviews...
I'm a noob but I made my application work beautifully using python manage.py runserver but when I brought it to Apache + mod_wsgi, I keep getting this error. The debug messages aren't much help. Here is a screenshot of the entire debug image: http://img694.imageshack.us/img694/6723/screenshotfb.png
Here is the dump of my http.conf file....
Let's say I have two Django models Person and Company as follows: -
class Company(models.Model):
name = models.CharField()
class Person(models.Model):
last_name = models.CharField(blank=True)
first_name = models.CharField()
company = models.ForeignKey(Company, null=True, blank=True)
A Person may or may not belong to ...
I am using a custom cache backend to wrap the built-in cache backends so that I can add the current site_id to all the cache_keys (this is useful for multi-site functionality with a single memcached instance)
unfortunately it works great on the django built-in devserver, but give a nasty error when I try to run it on the live server wit...
There was a nearly similar question: http://stackoverflow.com/questions/1160030/how-to-make-email-field-unique-in-model-user-from-contrib-auth-in-django
The solution was not perfect: Validating email for uniqueness. The solution provided is rather funny. It disallows modifications to User that leave email intact. How to fix it? Thanks i...