When getting the IP with request.META['REMOTE_ADDR'] code. This works fine on the local system but when hosted on a web server the ip got is 127.0.0.1 - How can this be resolved?
...
Days ago I read something like "Ruby on Rails is for web applications, Django is for standard webpages". Is that true?
I have to decide in the next weeks if I go with Ruby on Rails or Django for an university project. It will be an email marketing software.
What do you advise me to use?
...
I have a django view, and this view returns a table which is populated asynchronously with an ajax call.
From the design point of view, which one should I follow:
the django view, called via ajax, returns the content of the table as a json response, containing html markups for each cell. The javascript callback handler takes the cont...
I'm creating this:
# models.py
class Item(models.Model):
sku = models.CharField(max_length=20)
class Attribute(models.Model):
item = models.ForeignKey(Item, related_name='items')
Is that going to cause naming collisions in Python? Like:
# views.py
some_object.items.create(sku='123abc')
# Is there a place / way that this c...
Can someone please explain why is meta class used in the following example.
Ex:
Class Employee (models.Model):
name = models.ForeignKey(name)
Gender = models.IntegerField()
class Meta:
ordering = ["Gender"]
Thanks...
...
So I am trying to make Django running with mod-wsgi for the first time. I have configured Apache as shown in examples and I am pretty sure I did everything right.
I did not set the PYTHON_EGG_CACHE variable so it uses the default: /var/www/.python-eggs. I have created this directory and made it writeable for user www-data.
When I open ...
Hi!
I have a basic model :
class MyModel(models.Model):
my_field = models.CharField()
I have a basic form for this model :
class MyFrom(forms.ModelForm):
class Meta:
model = MyModel
And I have a function that does a basic lookup (a lot more complex in reality, regex etc. won't do) :
POSSIBLE_VALUES = ['aa', 'bb', ...
I'm doing some introductory work with django which seems really easy (and fun) so far but I have been doing all this from Python 2.6 which I installed in /opt/local (RedHat 5.3) because the python that came with redhat was 2.4. I set up a symlink:
/usr/bin/python2.6 -> /opt/local/bin/python
and I have been using that for all the djang...
I am sending information between client and django server and I would like to use json to this. I am sending simple information - list of strings. I tried using django.core.serializers, but when I did, I got
AttributeError: 'str' object has no attribute '_meta'
It seems, this can be used only for django objects. How can I serialize si...
If I have following database fields: id, name, emp_id.
How do I make a query in Django to get the values of column name only with a where clause.
Thanks...
...
I have created a new environement in virtualenv with --no-site-packages and executed activate file. So, shouldn't my current Django app show any error? Environement doesn't have Django installed. I think, my site is using my old python with Django. How can I change it?
Maybe it's because my .htaccess file, here it is:
SetHandler mod_pyt...
I am trying to get django up and running in production mode but I get this error that I can't seem to fix:
ExtractionError: Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg cache:
[Errno 13] Permission denied: '/home/james/.python-eggs'
The Python egg cache directory ...
I have a very simple django site but I have trouble getting the images that I upload in the admin panel to show.
my settings.py has these constants:
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/home/jeroen/programming/python/django/ninikske/media'
# URL that handles the...
As I'm writing an application which uses twisted web for serving async requests and Django for normal content delivery, I thought it would have been nice to have both run under the same twisted reactor through the WSGI interface of Django.
I also wanted to test my app using the nice test server facility that Django offers. At first I si...
I have previously had python installed because of postfix. I then installed Django. Next, I tried to install mod_wsgi for deploying a Django application. I get this error:
make: * [mod_wsgi.la] error 1
Apparently it is due to an older version of python. I tried to install a newer version of python but I still get the same problem. This...
For example:
class Subdomain(Site):
#fields here
and
class Subdomain(models.Model):
site = models.OneToOne(Site)
#fields here
...
Hey people,
Im trying to do a formset with the following models (boost is the primary):
class boost(models.Model):
creator = models.ForeignKey(userInfo)
game = models.ForeignKey(gameInfo)
name = models.CharField(max_length=200)
desc = models.CharField(max_length=500)
rules = models.CharField(max_length=500)
subsc...
As part of trying out django CMS (http://www.django-cms.org/), I'm struggling with getting Python-MySQLdb to work (http://pypi.python.org/pypi/MySQL-python/).
I have installed Django CMS and all of its dependencies (Python 2.5, Django, django-south, MySQL server)
I'm trying out the example code within Django CMS code with MySQL as chos...
Hi everybody,
I want to change the shape of some fields showed in the admin site.
I found that the template that manage everything is change_form.html with fieldset.html but I cannot find where the fields are actually transformed in html.
Basically I want to change the field of the foreign key adding a link to another page.
Do you hav...
When the page loads, I have a JavaScript function that needs to analyze the JSON. But, this JSON must be present when I load "something.html"
I know how to do this, but I don't know how to combine them together.
return HttpResponse(thejson, mimetype="application/javascript")
...