fetching data from intermediate many-to-many table
Hello! Assume we have the following models: class Book(models.Model): title = models.CharField() sequences = models.ManyToManyField(Sequence, through='BookSequence') class Sequence(models.Model): name = models.CharField(unique=True) class BookSequence(models.Model): class Meta: unique_together = ('book', 'sequence') book = models.ForeignKey(Book) sequence = models.ForeignKey(Sequence, related_name='detail') number_in_sequence = models.IntegerField() ...and are trying to select the sequences a concrete book belongs to, along with the number of this book in the sequence: def print_book_sequences(): book = Book.objects.get(pk=1) for seq in book.sequences.select_related(): number_in_sequence = seq.detail.get(book=book, sequence=seq).seq_number print seq.name, number_in_sequence So, the question is: Is there any way in django to select sequence name and sequence number in one sql query? The code in print_book_sequences results in two sql queries per sequence, one selecting name and one number. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django-admin.py startproject mysite
yes.I have installed it with the setuptools (python setup.py install) is that affect in my issue? On Apr 30, 5:25 pm, Yongning Liang wrote: > if you tried the command django-admin.py startproject mysite and it output > the usage, it mean the PATH of Python and django-admin.py is correct, maybe > you type a wrong subcommand. > BTW, are you install Django with setuptools(python setup.py install)? > > > > > > > > On Sat, Apr 30, 2011 at 10:16 PM, Daisy wrote: > > I have just did what you said and the result was (no project created) > > and the output was: > > > > > Usage: django-admin.py subcommand [options] [args] > > > Options: > > -v VERBOSITY, --verbosity=VERBOSITY > > Verbosity level; 0=minimal output, 1=normal > > output, > > 2=all output > > --settings=SETTINGS The Python path to a settings module, e.g. > > "myproject.settings.main". If this isn't > > provided, the > > DJANGO_SETTINGS_MODULE environment variable > > will be > > used. > > --pythonpath=PYTHONPATH > > A directory to add to the Python path, e.g. > > "/home/djangoprojects/myproject". > > --traceback Print traceback on exception > > --version show program's version number and exit > > -h, --help show this help message and exit > > > Type 'django-admin.py help ' for help on a specific > > subcommand. > > > Available subcommands: > > cleanup > > compilemessages > > createcachetable > > dbshell > > diffsettings > > dumpdata > > flush > > inspectdb > > loaddata > > makemessages > > reset > > runfcgi > > runserver > > shell > > sql > > sqlall > > sqlclear > > sqlcustom > > sqlflush > > sqlindexes > > sqlinitialdata > > sqlreset > > sqlsequencereset > > startapp > > startproject > > syncdb > > test > > testserver > > validate > > > > > while surfing the net I found this solution, write in the console > > > python C:\Python27\Scripts\django-admin.py startproject mysite > > > I don't know if there is another solution instead of writing the above > > line every time or not. > > > thanks for help. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to setup the django progject to apache2
Hi, I want to develop Django on the Apache2 server. And I have follow the some instruction about how to setup django app on the apache2 server. but allows failed. My system is Ubuntu 10.10. what my step as below: (1) sudo apt-get install apache2 (2) sudo apt-get install libapache2-mod-wsgi when I opened 127.0.0.1 . "It works!" displayed. And I can find wsgi.conf and wsgi.load file under the path /etc/apache2/mods-enabled So Apache2 and Mod_wsgi are installed. My project "djcms" is under the path /home/zikey/Workspace/Django/djcms. And the "settings.py" file is under djcms folder. I modifed the file httpd.conf as below:(original file is empty) ## ServerAdmin webmaster@localhost WSGIScriptAlias / /home/zikey/Workspace/Django/djcms/django.wsgi AllowOverride None Order deny,allow allow from all ### And put the django.wsgi file under /home/zikey/Workspace/Django/djcms. The content of django.wsgi is like this: ### import os import sys current_dir = os.path.dirname(__file__) if current_dir not in sys.path: sys.path.append(current_dir) os.environ['DJANGO_SETTINGS_MODULE'] = "settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() ### But every time I run the URL http://127.0.0.1:9000 it always displays: "Oops! Google Chrome could not connect to 127.0.0.1:9000 " :( Do you know what I missed ? Br, Steven -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
bs = BookSequence.objects.filter(book__pk=1).select_related() for s in bs: print s.sequence.name, s.number_in_sequence On Sun, May 1, 2011 at 1:30 PM, Alex <4d876...@gmail.com> wrote: > Hello! > Assume we have the following models: > > > class Book(models.Model): >title = models.CharField() >sequences = models.ManyToManyField(Sequence, > through='BookSequence') > > class Sequence(models.Model): >name = models.CharField(unique=True) > > class BookSequence(models.Model): >class Meta: >unique_together = ('book', 'sequence') > >book = models.ForeignKey(Book) >sequence = models.ForeignKey(Sequence, related_name='detail') >number_in_sequence = models.IntegerField() > > > ...and are trying to select the sequences a concrete book belongs to, > along with the number of this book in the sequence: > > > def print_book_sequences(): >book = Book.objects.get(pk=1) >for seq in book.sequences.select_related(): >number_in_sequence = seq.detail.get(book=book, > sequence=seq).seq_number >print seq.name, number_in_sequence > > > So, the question is: > > Is there any way in django to select sequence name and sequence number > in one sql query? > The code in print_book_sequences results in two sql queries per > sequence, one selecting name and one number. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
Btw, the url.py is like this: from django.conf.urls.defaults import patterns, include, url from django.views.generic import DetailView,ListView from polls.models import Poll # Uncomment the next two lines to enable the admin: #zikey from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^polls/$',ListView.as_view(queryset=Poll.objects.order_by('-pub_date')[:5], context_object_name='latest_poll_list', template_name='polls/index.html')), ) # 2011/5/1 Steven Han > Hi, > > I want to develop Django on the Apache2 server. And I have follow the some > instruction about how to setup django app on the apache2 server. > but allows failed. > > My system is Ubuntu 10.10. what my step as below: > > (1) sudo apt-get install apache2 > (2) sudo apt-get install libapache2-mod-wsgi > > when I opened 127.0.0.1 . "It works!" displayed. And I can find wsgi.conf > and wsgi.load file under the path /etc/apache2/mods-enabled > So Apache2 and Mod_wsgi are installed. > > My project "djcms" is under the path /home/zikey/Workspace/Django/djcms. > And the "settings.py" file is under djcms folder. > I modifed the file httpd.conf as below:(original file is empty) > > ## > > ServerAdmin webmaster@localhost > > WSGIScriptAlias / /home/zikey/Workspace/Django/djcms/django.wsgi > > AllowOverride None > Order deny,allow > allow from all > > > > > > ### > > And put the django.wsgi file under /home/zikey/Workspace/Django/djcms. > The content of django.wsgi is like this: > > ### > > import os > import sys > > current_dir = os.path.dirname(__file__) > > if current_dir not in sys.path: > sys.path.append(current_dir) > > os.environ['DJANGO_SETTINGS_MODULE'] = "settings' > > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > > ### > > But every time I run the URL http://127.0.0.1:9000 > it always displays: > "Oops! Google Chrome could not connect to 127.0.0.1:9000 " > > > :( > Do you know what I missed ? > > Br, > Steven > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
Bit confused matey, Do you have a domain name to serve those pages to? If you are just trying to run it from localhost, 127.0.0.1: why not just use the Django development server? Rob -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
2011/5/1 Oleg Lomaka <...@gmail.com>: > bs = BookSequence.objects.filter(book__pk=1).select_related() > for s in bs: > print s.sequence.name, s.number_in_sequence Oh, thanks! Is it possible then to do left/right outer joins, as there may exist books without sequences and sequences without books? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
no , I don't And I can use pythom manage.py runserver to run the project. But I just want to use the apache server. After installing the apache. I didn't modify any files except the httpd.conf file. 2011/5/1 Robbington > Bit confused matey, > > Do you have a domain name to serve those pages to? > > If you are just trying to run it from localhost, 127.0.0.1: why not > just use the Django development server? > > Rob > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
Fair enough, But if you are in the stages of development then its best to use the development server due to the way apache caches data, as changes to your code may not always show straight away leaving you scratching your head as to what is causing any unforeseen errors. Anyways, if you are really looking to use Apache, it would seem to me like you are missing a document root in your virtual host settings. no expert I must confess as I gave up with apache and started using Cherokee a while ago. Might also be as you have nothing in your urls.py to match to index. ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: form input
in models.py you define your database fields: The use a ModelForm: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#modelform Or try the generic create/update/delete views: http://docs.djangoproject.com/en/dev/ref/generic-views/?from=olddocs#create-update-delete-generic-views On Apr 30, 4:24 pm, Pulkit Mehrotra wrote: > can anyone tell me the precise way of taking an input from a form and > storing it in a database > or provide a good link where i can find one > > i am a newbie so please help me > > thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Attribute error
Capitalize class names. class Wish(models.Model): the_wish = models.CharField(max_length=100) On Apr 30, 4:26 pm, Pulkit Mehrotra wrote: > changed the name but nothing happened > the django version is 1.3 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: probably a simple query: looping for an integer number within an html page
Can you provide more details? What error are you getting? Or you get no error and no output? Are you sure you are inserting "somelist" in the context? Is somelist a list of integers or is it an object with an attribute int_item that is a list of ints? Br, On Apr 30, 10:42 pm, Jason <1jason.whatf...@gmail.com> wrote: > Hi there, > > I am writing a list with values to a web page. Within that page a list item > (somelist.int_item) takes an integer value. What I'm trying (and failing) to > do is to write a for loop that repeats for the number in the integer item. > > So far I've got > > {% for number in somelist.int_item %} > Item number {{ number }} > {% endfor %} > > At the moment this isn't running at all... > > Any ideas? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
Sorry, but your question is too general as for me. Django doesn't support SQL joins directly. Could you specify with an example what data do you need to get from database using "joins"? For example if you need to retrieve all books with zero associated sequences (empty sequences list), then code snippet may looks something like this: Book.objects.annotate(s_count=Count('sequences')).filter(s_count=0) May be if you read docs on ManyToMany relations, you'll find more nicer solution. 2011/5/1 А.Р. <4d876...@gmail.com> > 2011/5/1 Oleg Lomaka <...@gmail.com>: > > > bs = BookSequence.objects.filter(book__pk=1).select_related() > > for s in bs: > >print s.sequence.name, s.number_in_sequence > > Oh, thanks! > Is it possible then to do left/right outer joins, as there may exist > books without > sequences and sequences without books? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Troubleshooting: How do I make JavaScript shotcuts 'today' and 'now' display?
Hello and thanks in advance, I am running Django 1.3 on Firefox 4.0.1 under Python 2.7.1 on Windows Vista. The second page of the introductory tutorial at Django's official homepage says: "Each DateTimeField gets free JavaScript shortcuts. Dates get a 'Today' shortcut and calendar popup, and times get a 'Now' shortcut and a convenient popup that lists commonly entered times." I can clearly see what the author is talking about on his screenshots, however, I don't see, nor am I able to click on or use in any way, these graphical 'shortcuts' when I am logged into the Django admin area. I have already googled this in vain. Thanks for your help! -Rodney ___ Please visit my homepage: http://www.squidoo.com/dotcomboy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
Oleg Lomaka <...@gmail.com> : > Sorry, but your question is too general as for me. Django doesn't support > SQL joins directly. Could you specify with an example what data do you need > to get from database using "joins"? I just wonder if it is possible to get data from those three tables in one sql query using django. So far we have two queries, one fetching data from the `book` table (title etc.), and after that the second fetching sequences (genres, etc.) for this book. I don't at all mind it be two separate queries, just curiosity. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Overwriting the handler404
Hi there, i am trying to overwrite handler404 of django so that i can call my own view function when it doesnot find the appropriate view and if it tries to give Http404. the whole problem is as follows: i defined my view function called 'remap_test' in my proxy app. and i changed the default handler404 to handler404 = 'proxy.views.remap_test'. The problem is that it gives all the time 404 error even if the handler404 is defined right and even if it is in right place(in urls.py) and the settings.py has the DEBUG = FALSE and my new view function is theoretically ready to be called. but it isnot called, sometimes it is. it is sooo weird. i will post here the code blocks i added: in my urls.py is this: handler404 = 'proxy.views.remap_test' . and my view function is this: def remap_test(request): return HttpResponse("test message as 404") and my model is this: class Remap(models.Model): new_url = models.CharField(max_length=50) src_url = models.CharField(max_length=150) def __unicode__(self): return self.src_url ... i dont know why it calls 404 all the time, sometimes i get the problem if i add items to my database tables in admin, and sometimes not. can someone please help me with this or does anyone have an idea what the problem could be ? thank you guys so much in advance, doni -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
We don't need the first query for fetching books. All data about book available from BookSequence too. And all filters you apply to books, you can apply to BookSequence via book__ filter. Again, from my first example, and using just one query bs = BookSequence.objects.filter(book__title__startswith='Hello'). select_related() for s in bs: print s.sequence.name, s.number_in_sequence, *s.book.title* 2011/5/1 А. Р. <4d876...@gmail.com> > I just wonder if it is possible to get data from those three tables in > one sql query using django. > So far we have two queries, one fetching data from the `book` table > (title etc.), and after that the > second fetching sequences (genres, etc.) for this book. > > I don't at all mind it be two separate queries, just curiosity. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
On Sun, May 1, 2011 at 12:41 PM, Steven Han wrote: > But every time I run the URL http://127.0.0.1:9000 > it always displays: > > "Oops! Google Chrome could not connect to 127.0.0.1:9000 " > > :( > Do you know what I missed ? This is more an apache question than a django question, however I think you're missing to let the server actually listen on port 9000. Try adding a line like: Listen 9000 outside your virtualhost directive. See http://httpd.apache.org/docs/2.2/bind.html#virtualhost for details -- Gianluca Sforna http://morefedora.blogspot.com http://identi.ca/giallu - http://twitter.com/giallu -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
Oleg Lomaka <...@gmail.com> : > We don't need the first query for fetching books. All data about book > available from BookSequence too. And all filters you apply to books, you can > apply to BookSequence via book__ filter. Again, from my first example, and > using just one query > bs = > BookSequence.objects.filter(book__title__startswith='Hello').select_related() > for s in bs: > print s.sequence.name, s.number_in_sequence, s.book.title That's right. But if we have a book that doesn't belong to any sequence, bs will be *empty*. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
I got the error like this: Forbidden You don't have permission to access / on this server. -- Apache/2.2.16 (Ubuntu) Server at 127.0.0.1 Port 9000 when I modify the httpd.conf: Listen 9000 ServerAdmin webmaster@localhost WSGIScriptAlias / /home/zikey/Workspace/Django/djcms/django.wsgi DocumentRoot /home/zikey/Workspace/Django/djcms AllowOverride None Order deny,allow allow from all 2011/5/1 Gianluca Sforna > On Sun, May 1, 2011 at 12:41 PM, Steven Han wrote: > > But every time I run the URL http://127.0.0.1:9000 > > it always displays: > > > > "Oops! Google Chrome could not connect to 127.0.0.1:9000 " > > > > :( > > Do you know what I missed ? > > This is more an apache question than a django question, however I > think you're missing to let the server actually listen on port 9000. > > Try adding a line like: > Listen 9000 > outside your virtualhost directive. > > See http://httpd.apache.org/docs/2.2/bind.html#virtualhost for details > > > -- > Gianluca Sforna > > http://morefedora.blogspot.com > http://identi.ca/giallu - http://twitter.com/giallu > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Resolve function ?
hi There, i am novice in django so i need your help, i read books but if i talk to you guys, may be i get it faster than reading books. so, what doesnot give me peace is that i dont understand the function resolve and how to use it. say, i want to get the view from this request: /s/? o=logo&switch=S&plz=&dist=10&Dein_Studium=6&firmenname=&p_id=254/ what i dont understand is that resolve needs a path, but i cannot get a path from this request, because it has only /s/ as a path and i cannot call a view function for this /s/ path. view, args, kwargs = resolve(' /s/? o=logo&switch=S&plz=&dist=10&Dein_Studium=6&firmenname=&p_id=254/ ') kwargs['request'] = request return view(*args, **kwargs) i dont understand how this works, can some help me please ? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
Hm... Again I think I have answered this question already. Book.objects.annotate(s_count=Count('sequences')).filter(s_count=0) These are books, that doesn't belong to any sequence. And with one query (though quite heavy query). 2011/5/1 А. Р. <4d876...@gmail.com> > > That's right. But if we have a book that doesn't belong to any sequence, > bs will be *empty*. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django postgre_psycopg2 error
hi, im deploying my django app in a webhost (mochahost) and i get this error MOD_PYTHON ERROR ProcessId: 23641 Interpreter:'gruporole.com' ServerName: 'gruporole.com' DocumentRoot: '/home/gruporol/public_html' URI:'/services' Location: None Directory: '/home/gruporol/public_html/' Filename: '/home/gruporol/public_html/services' PathInfo: '' Phase: 'PythonHandler' Handler:'django.core.handlers.modpython' Traceback (most recent call last): File "/usr/lib64/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/usr/lib64/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg) File "/usr/lib64/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target result = object(arg) File "/home/gruporol/soft/django/core/handlers/modpython.py", line 213, in handler return ModPythonHandler()(req) File "/home/gruporol/soft/django/core/handlers/modpython.py", line 191, in __call__ response = self.get_response(request) File "/home/gruporol/soft/django/core/handlers/base.py", line 169, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/home/gruporol/soft/django/core/handlers/base.py", line 214, in handle_uncaught_exception if resolver.urlconf_module is None: File "/home/gruporol/soft/django/core/urlresolvers.py", line 274, in _get_urlconf_module self._urlconf_module = import_module(self.urlconf_name) File "/home/gruporol/soft/django/utils/importlib.py", line 35, in import_module __import__(name) File "/home/gruporol/soft/role/urls.py", line 4, in from django.contrib import admin File "/home/gruporol/soft/django/contrib/admin/__init__.py", line 3, in from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME File "/home/gruporol/soft/django/contrib/admin/helpers.py", line 3, in from django.contrib.admin.util import (flatten_fieldsets, lookup_field, File "/home/gruporol/soft/django/contrib/admin/util.py", line 1, in from django.db import models File "/home/gruporol/soft/django/db/__init__.py", line 78, in connection = connections[DEFAULT_DB_ALIAS] File "/home/gruporol/soft/django/db/utils.py", line 93, in __getitem__ backend = load_backend(db['ENGINE']) File "/home/gruporol/soft/django/db/utils.py", line 33, in load_backend return import_module('.base', backend_name) File "/home/gruporol/soft/django/utils/importlib.py", line 35, in import_module __import__(name) File "/home/gruporol/soft/django/db/backends/postgresql_psycopg2/ base.py", line 9, in from django.db import utils ImportError: cannot import name utils in my pc this code work fine but in the hosting gaveme this, what can i do to solve this. help please. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django postgre_psycopg2 error
Read the traceback you posted. The bottom line tells you exactly where the problem is. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django postgre_psycopg2 error
yes the line tell that cant find util.py but this only happend with postgresql because i tested with mysql and work fine, so what is the problem, i have installed psycopg python 2.5 django 1.3 in my laptop this work perfect but in the host dont, i read som post in internet but the problem was python 2.6 but i have python 2.5, i really need help with this. El ayer es un recuerdo, el mañana es un misterio y el ahora es un regalo...por eso se llama presente. Ing. Yasmany Cubela Medina: Linux user 446757 Ubuntu user 13464 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django postgre_psycopg2 error
This has nothing to do with Postgres. This is a simple Python issue. Your production machine isn't set up the same as your development machine. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
Did you tried to put your configuration in a file similar to default inside /etc/apache2/sites-available then try to make an enable to the site using a2ensite follwed by the name of your file, and I guess you should leave httpd.conf blank. Regards, George On May 1, 1:41 pm, Steven Han wrote: > Hi, > > I want to develop Django on the Apache2 server. And I have follow the some > instruction about how to setup django app on the apache2 server. > but allows failed. > > My system is Ubuntu 10.10. what my step as below: > > (1) sudo apt-get install apache2 > (2) sudo apt-get install libapache2-mod-wsgi > > when I opened 127.0.0.1 . "It works!" displayed. And I can find wsgi.conf > and wsgi.load file under the path /etc/apache2/mods-enabled > So Apache2 and Mod_wsgi are installed. > > My project "djcms" is under the path /home/zikey/Workspace/Django/djcms. And > the "settings.py" file is under djcms folder. > I modifed the file httpd.conf as below:(original file is empty) > ###### > > ServerAdmin webmaster@localhost > > WSGIScriptAlias / /home/zikey/Workspace/Django/djcms/django.wsgi > > AllowOverride None > Order deny,allow > allow from all > > > > > ### > > And put the django.wsgi file under /home/zikey/Workspace/Django/djcms. > The content of django.wsgi is like this: > ### > > import os > import sys > > current_dir = os.path.dirname(__file__) > > if current_dir not in sys.path: > sys.path.append(current_dir) > > os.environ['DJANGO_SETTINGS_MODULE'] = "settings' > > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > ### > > But every time I run the URLhttp://127.0.0.1:9000 > it always displays: > "Oops! Google Chrome could not connect to 127.0.0.1:9000 " > > :( > Do you know what I missed ? > > Br, > Steven -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django postgre_psycopg2 error
yes is the deploy enviroment that have the problem but i ask for help for fixit because if all other django framework works why this pacticullary db backend throw this error. if any one can put me in the right direction or gave some advices. El ayer es un recuerdo, el mañana es un misterio y el ahora es un regalo...por eso se llama presente. Ing. Yasmany Cubela Medina: Linux user 446757 Ubuntu user 13464 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unable to log in to admin using RemoteUserMiddleware
So I figured out a hack to solve this problem and hopefully this will save someone from this problem in the future. After RemoteUserMiddleware is included in the settings.py file, when you visit any area of the site where your server asks you to log in, once you log in it will automatically create an entry for your username in the database table auth_user. This row with your server's username is created the first time you do this. Now the problem is, when you go to the admin site, you are technically already logged in to your server, but you see the dialog box asking for username and password. You might think to yourself, "I should just be able to enter a superuser's credentials and log in", but this will not work. And if you think about it, it's kind of weird. Your already logged in to your server via your username, which your django app is now using, and then trying to enter someone else's credentials (i.e. the superuser). So its like your trying to log in on top of your servers username with the superuser. Kind of weird. So what can you do? If you look at the entry in the database that was generated when you first logged in to your django app using your server's username, the values 'is_staff' and 'is_superuser' are set to '0'. All you need to do is manually set 'is_superuser' for that entry. Then when you go to the admin site, it will automatically authenticate you, no need to provide credentials again. So for mysql you would need to run the following command (substitute ' usern...@your-server.com' with the username you use for your server): *UPDATE auth_user SET is_superuser='1' where username = ' usern...@your-server.com';* I hope this helps anyone that has the same issue. Feel free to contact me with any questions at dtdan...@indiana.edu Cheers! Dustin On Sat, Apr 30, 2011 at 9:40 PM, Dustin wrote: > Hello, > > I'm having difficulty finding a fix for this problem. Someone posted > the exact same problem I am having about a year ago. Has there been > any solution to this? > > Basically, RemoteUserMiddleware is working just fine after I followed > these directions: > http://docs.djangoproject.com/en/dev/howto/auth-remote-user/#configuration > > My problem is that I can not seem to log into the admin site with any > users, even superusers created via manage.py > > Here is a link to the old article: > > http://groups.google.com/group/django-users/browse_thread/thread/0fe27b2ca4056c8a/7a12438967014133?show_docid=7a12438967014133 > > Any help will be extremely appreciated :) > > Thank you, > Dustin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unable to log in to admin using RemoteUserMiddleware
So I figured out a hack to solve this problem and hopefully this will save someone from this problem in the future. After RemoteUserMiddleware is included in the settings.py file, when you visit any area of the site where your server asks you to log in, once you log in it will automatically create an entry for your username in the database table auth_user. This row with your server's username is created the first time you do this. Now the problem is, when you go to the admin site, you are technically already logged in to your server, but you see the dialog box asking for username and password. You might think to yourself, "I should just be able to enter a superuser's credentials and log in", but this will not work. And if you think about it, it's kind of weird. Your already logged in to your server via your username, which your django app is now using, and then trying to enter someone else's credentials (i.e. the superuser). So its like your trying to log in on top of your servers username with the superuser. Kind of weird. So what can you do? If you look at the entry in the database that was generated when you first logged in to your django app using your server's username, the values 'is_staff' and 'is_superuser' are set to '0'. All you need to do is manually set 'is_superuser' for that entry. Then when you go to the admin site, it will automatically authenticate you, no need to provide credentials again. So for mysql you would need to run the following command (substitute 'usern...@your-server.com' with the username you use for your server): UPDATE auth_user SET is_superuser='1' where username = 'username@your- server.com'; I hope this helps anyone that has the same issue. Feel free to contact me with any questions at dtdan...@indiana.edu Cheers! Dustin On Apr 30, 9:40 pm, Dustin wrote: > Hello, > > I'm having difficulty finding a fix for this problem. Someone posted > the exact same problem I am having about a year ago. Has there been > any solution to this? > > Basically, RemoteUserMiddleware is working just fine after I followed > these > directions:http://docs.djangoproject.com/en/dev/howto/auth-remote-user/#configur... > > My problem is that I can not seem to log into the admin site with any > users, even superusers created via manage.py > > Here is a link to the old > article:http://groups.google.com/group/django-users/browse_thread/thread/0fe2... > > Any help will be extremely appreciated :) > > Thank you, > Dustin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Resolve function ?
On Sun, May 1, 2011 at 1:34 PM, doniyor wrote: > hi There, > > i am novice in django so i need your help, i read books but if i talk > to you guys, may be i get it faster than reading books. > > so, what doesnot give me peace is that i dont understand the function > resolve and how to use it. > > say, i want to get the view from this request: /s/? > o=logo&switch=S&plz=&dist=10&Dein_Studium=6&firmenname=&p_id=254/ > what i dont understand is that resolve needs a path, but i cannot get > a path from this request, because it has only /s/ as a path and i > cannot call a view function for this /s/ path. > > view, args, kwargs = resolve(' /s/? > o=logo&switch=S&plz=&dist=10&Dein_Studium=6&firmenname=&p_id=254/ ') > kwargs['request'] = request > return view(*args, **kwargs) > > i dont understand how this works, > > can some help me please ? > > Thanks Have you considered consolidating some of those querystring parameters into a more concise URL hierarchy? One of the benefits of using prettier URLs is better usage of Django's URL handling tools. -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Using User.add_to_class
First of all, I'm a noob. But why not using a custom User model altogether? Such as UserProfile with an FK to auth User and run the checks against that in your app? This seems to be like the solution with less maintenance overhead. Sincerely, André Terra (airstrike) On Fri, Apr 29, 2011 at 12:03 AM, Venkatraman S wrote: > Resending : > > > > On Wed, Apr 27, 2011 at 4:13 PM, Venkatraman S wrote: > >> Hi, >> >> In my app, i have many functions added to the User class using >> User.add_to_class ; these are basically the functions that restrict the >> objects that can be viewed by the user during his session with the app. The >> functions are present in __init__.py in my project. >> >> My Q : is this a good paradigm to do things? i.e, restricting the user's >> workspace. Or is it better that i do the DB queries in my views - apply >> filter on the queries there. >> Which is a better model and would scale?(and also be easier if i implement >> caching in the near future). >> >> IMHO, i find User.add_to_class to be extremely useful and the code is much >> easier to maintain; but since this is a paradigm Q, i would let the more >> experienced answer this. >> >> -Venkat >> http://blizzardzblogs.blogspot.com/ >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
Oleg Lomaka <...@gmail.com> : > Hm... Again I think I have answered this question already. > Book.objects.annotate(s_count=Count('sequences')).filter(s_count=0) Right, but if you're trying to get book by id, this is not an option. Again, you will need to query db twice. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: fetching data from intermediate many-to-many table
> Oleg Lomaka <...@gmail.com> : > >> Hm... Again I think I have answered this question already. >> Book.objects.annotate(s_count=Count('sequences')).filter(s_count=0) > > Right, but if you're trying to get book by id, this is not an option. > Again, you will need to query db twice. > Besides, separate treating of books with and without sequences isn't a good design decision, I believe. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Upload image using GET
(sorry for my english) Hi!, i have a mobile application (iOS and Android), this applciation need to upload an image (internally) to a service . The service is written in C++ and use thrift to create a Client with python.. so i write a simple django application like and interface to the C++ service. Now i need to upload an image to the django application using a GET method.. The idea is: www.servidor.com/upload/path_to_image_in_device.png I don't know if this is the best method, but i need to programmatically upload an image create in the mobile device to the web page, so i think in use a url where i can pass the path to the image (in the device).. How can i accomplish that??? Thanks in advance.. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Upload image using GET
2011/5/2 msdark <...@gmail.com>: > The service is written in C++ and use thrift to create a Client with > python.. so i write a simple django application like and interface to > the C++ service. What is "thrift"? Do you really mean it? > > Now i need to upload an image to the django application using a GET > method.. You cannot, I think, unless your image is very tiny, then you can pass it's contents as a GET parameter. I suggest you use POST instead. > The idea is: www.servidor.com/upload/path_to_image_in_device.png I cannot get the image specified. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Upload image using GET
Thrift: http://incubator.apache.org/thrift/ And if it's not possible use GET to pass the image data to the django application.. how can i pass de data from a mobile application (without user actions like a web form) to the django application, and upload, or copy de data into a new image?? Thanks in advance El 01-05-2011, a las 22:59, А. Р. escribió: > 2011/5/2 msdark <...@gmail.com>: > > >> The service is written in C++ and use thrift to create a Client with >> python.. so i write a simple django application like and interface to >> the C++ service. > > What is "thrift"? Do you really mean it? > >> >> Now i need to upload an image to the django application using a GET >> method.. > > You cannot, I think, unless your image is very tiny, then you can pass > it's contents as a GET parameter. > I suggest you use POST instead. > >> The idea is: www.servidor.com/upload/path_to_image_in_device.png > > I cannot get the image specified. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > Matías Hernandez Arellano Ingeniero de Software/Proyectos en VisionLabs S.A CDA Archlinux-CL www.msdark.archlinux.cl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Upload image using GET
2011/5/2 Matias Hernandez Arellano <...@archlinux.cl>: > > And if it's not possible use GET to pass the image data to the django > application.. > how can i pass de data from a mobile application (without user actions like a > web form) to the django application, and upload, or copy de data into a new > image?? http://en.wikipedia.org/wiki/POST_%28HTTP%29 It is possible to send POST requests without user actions. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Form with manytomany field
Hi all, I'm trying to create a form from a model with ManyToManyField, I want something like this: You fill some fields from the referenced table and you click at 'Add' and this appears at a table below the fields, so when I click "Save" all the added items save (includind the new manytomany items) Example: *Name [ ]* *Email [ ]* *Add Companys you've Worked for:* *Company [ ] Telephone [ ] (ADD Button)* * * *CompanyTelephone* *Company XYZ 555 0123* *Company ABC 123 4567* * * *(Save Form Button)* * * I hope you can understand this... there's some easy way to implement this using Django? Best Regards, Daniel França -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Upload image using GET
yes, thanks.. i try using POST but i get a error 500 i only use this to test def upload_image(request): if request.method == 'POST': return "request.FILES['image']" return "NO imagen subida" El 01-05-2011, a las 23:11, А. Р. escribió: > 2011/5/2 Matias Hernandez Arellano <...@archlinux.cl>: >> >> And if it's not possible use GET to pass the image data to the django >> application.. >> how can i pass de data from a mobile application (without user actions like >> a web form) to the django application, and upload, or copy de data into a >> new image?? > > http://en.wikipedia.org/wiki/POST_%28HTTP%29 > > It is possible to send POST requests without user actions. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > Matías Hernandez Arellano Ingeniero de Software/Proyectos en VisionLabs S.A CDA Archlinux-CL www.msdark.archlinux.cl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Upload image using GET
On Sun, May 1, 2011 at 11:53 PM, Matias Hernandez Arellano wrote: > i only use this to test > def upload_image(request): > if request.method == 'POST': > return "request.FILES['image']" > return "NO imagen subida" is this your view function? if so, it should return a response object, not a string -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Upload from mobile device using POST
(sorry for my english) (i open this thread cuase the other thread was for another question) I have a mobile device application (iOS) and i want to upload an image to my django application In my mobile application i create the POST request (and disable csrf in my django app) using this: - (void)upload{ NSData *imageData = UIImageJPEGRepresentation(imageView.image,90); NSString *urlString = @"http://190.91.43.241:8000/subir/1/";; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init]autorelease]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *boundary = [NSString stringWithString:@"---14737809831466499882746641449"]; NSString *contentType=[NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; [request addValue:contentType forHTTPHeaderField:@"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"file\"; filename=\"file\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[NSData dataWithData:imageData]]; //[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; // setting the body of the post to the reqeust [request setHTTPBody:body]; // now lets make the connection to the web NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding]; NSLog(@"%@",returnString); } And in my Djago app: def upload_image(request): if request.method == 'POST': return request.FILES['file'] return "NO imagen subida" def subir(request,imagen): try: #some functions .. result = upload_image(request) return HttpResponse(result) except Thrift.TException, tx: print '%s' % (tx.message) but i have a error 500 and if i see the logs i have this: Exception Type: MultiValueDictKeyError Exception Value: "Key 'file' not found in " Any idea? thanks in advance.. (i'm a newbie with django and python) Matías Hernandez Arellano Ingeniero de Software/Proyectos en VisionLabs S.A CDA Archlinux-CL www.msdark.archlinux.cl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to setup the django progject to apache2
under the /etc/apache2/sites-available ,there are two files "default" and "default-ssl". when I modify it as the httpd.conf, and the file "000-default" under the /etc/apache2/sites-enables is updated automatically, and same as "default" under the sites-available. then empty the httpd.conf file。 the resault is also "403 Forbidden, no permission to access " 2011/5/2 George Ajam > Did you tried to put your configuration in a file similar to default > inside /etc/apache2/sites-available > then try to make an enable to the site using a2ensite follwed by the > name of your file, and I guess you should leave httpd.conf blank. > Regards, > George > > On May 1, 1:41 pm, Steven Han wrote: > > Hi, > > > > I want to develop Django on the Apache2 server. And I have follow the > some > > instruction about how to setup django app on the apache2 server. > > but allows failed. > > > > My system is Ubuntu 10.10. what my step as below: > > > > (1) sudo apt-get install apache2 > > (2) sudo apt-get install libapache2-mod-wsgi > > > > when I opened 127.0.0.1 . "It works!" displayed. And I can find wsgi.conf > > and wsgi.load file under the path /etc/apache2/mods-enabled > > So Apache2 and Mod_wsgi are installed. > > > > My project "djcms" is under the path /home/zikey/Workspace/Django/djcms. > And > > the "settings.py" file is under djcms folder. > > I modifed the file httpd.conf as below:(original file is empty) > > > ###### > > > > ServerAdmin webmaster@localhost > > > > WSGIScriptAlias / /home/zikey/Workspace/Django/djcms/django.wsgi > > > > AllowOverride None > > Order deny,allow > > allow from all > > > > > > > > > > > ### > > > > And put the django.wsgi file under /home/zikey/Workspace/Django/djcms. > > The content of django.wsgi is like this: > > > ### > > > > import os > > import sys > > > > current_dir = os.path.dirname(__file__) > > > > if current_dir not in sys.path: > > sys.path.append(current_dir) > > > > os.environ['DJANGO_SETTINGS_MODULE'] = "settings' > > > > import django.core.handlers.wsgi > > application = django.core.handlers.wsgi.WSGIHandler() > > > > > ### > > > > But every time I run the URLhttp://127.0.0.1:9000 > > it always displays: > > "Oops! Google Chrome could not connect to 127.0.0.1:9000 " > > > > :( > > Do you know what I missed ? > > > > Br, > > Steven > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.