django.core.handlers.wsgi not found
I am trying to deploy my django app on a newly setup CentOS box. I have successfully deployed it on ubuntu and on a Mac. I get these errors in the apache error log: [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi (pid=13616): Target WSGI script '/usr/local/myapp/scripts/myapp.wsgi' cannot be loaded as Python module. [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi (pid=13616): Exception occurred processing WSGI script '/usr/local/ myapp/scripts/myapp.wsgi'. [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] Traceback (most recent call last): [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] File "/usr/ local/myapp/scripts/myapp.wsgi", line 8, in [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] import django.core.handlers.wsgi [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] ImportError: No module named django.core.handlers.wsgi >From command line python the import works: $ python Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import django.core.handlers.wsgi >>> I also have this warning in the apache log: [Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Compiled for Python/2.6.2. [Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Runtime using Python/ 2.6.6. I've checked permissions, and wsgi.py and every dir in the path to it is 755. Anyone know why my app isn't finding it? TIA! -larry -- 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.core.handlers.wsgi not found
On Feb 4, 7:47 pm, Brett Epps wrote: > Sometimes it can help to print sys.path in your WSGI file. (The output > should end up in the apache error log.) That should tell you where Python > is looking for modules. If the Django install path is not listed, you may > need to reinstall Django. It's exactly the same sys.path I get from command line python, where the import works. >From the apache error log: ['/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/ usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat- linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/ usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/ usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site- packages/gtk-2.0', '/usr/lib/python2.6/site-packages/setuptools-0.6c11- py2.6.egg-info', '/usr/lib/python2.6/site-packages/webkit-1.0'] $ python Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.path ['', '/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/ plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib- old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site- packages', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/ python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages/ setuptools-0.6c11-py2.6.egg-info', '/usr/lib/python2.6/site-packages/ webkit-1.0'] > How was Django installed originally? django was install from svn like this: #svn co http://code.djangoproject.com/svn/django/trunk/django /usrl/ lib/python2.6/dist-packages/django #ln -s /usrl/lib/python2.6/dist-packages/django /usr/lib/python2.6/ site-packages/django Which is the same way I've done it on the other systems I've deployed this app on. mod_wsgi was installed with yum. Thanks! -larry > Brett > > On 2/4/12 6:53 PM, "larry.mart...@gmail.com" > wrote: > > >I am trying to deploy my django app on a newly setup CentOS box. I > >have successfully deployed it on ubuntu and on a Mac. > > >I get these errors in the apache error log: > > >[Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi > >(pid=13616): Target WSGI script '/usr/local/myapp/scripts/myapp.wsgi' > >cannot be loaded as Python module. > >[Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi > >(pid=13616): Exception occurred processing WSGI script '/usr/local/ > >myapp/scripts/myapp.wsgi'. > >[Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] Traceback (most > >recent call last): > >[Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] File "/usr/ > >local/myapp/scripts/myapp.wsgi", line 8, in > >[Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] import > >django.core.handlers.wsgi > >[Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] ImportError: No > >module named django.core.handlers.wsgi > > >From command line python the import works: > > >$ python > >Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) > >[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 > >Type "help", "copyright", "credits" or "license" for more information. > >>>> import django.core.handlers.wsgi > > >I also have this warning in the apache log: > > >[Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Compiled for Python/2.6.2. > >[Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Runtime using Python/ > >2.6.6. > > >I've checked permissions, and wsgi.py and every dir in the path to it > >is 755. > > >Anyone know why my app isn't finding it? > > >TIA! > >-larry > > >-- > >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: django.core.handlers.wsgi not found
On Feb 4, 9:52 pm, BlackKnight wrote: > http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives > > have you added this in apache conf, > > > SetHandler wsgi-script > Options ExecCGI > No, I do not have that, but I do have: WSGIScriptAlias / /usr/local/myapp/scripts/myapp.wsgi Which is what I have on all the other systems I've deployed this app on. But I did try removing that line, and adding what you suggested - that made the error go away, but my app does not work - i.e. my app's URLs are not recognized or resolved. With that line left in and the additional Directory directive, I get the same error. > > On Feb 5, 5:53 am, "larry.mart...@gmail.com" > wrote: > > > I am trying to deploy my django app on a newly setup CentOS box. I > > have successfully deployed it on ubuntu and on a Mac. > > > I get these errors in the apache error log: > > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi > > (pid=13616): Target WSGI script '/usr/local/myapp/scripts/myapp.wsgi' > > cannot be loaded as Python module. > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] mod_wsgi > > (pid=13616): Exception occurred processing WSGI script '/usr/local/ > > myapp/scripts/myapp.wsgi'. > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] Traceback (most > > recent call last): > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] File "/usr/ > > local/myapp/scripts/myapp.wsgi", line 8, in > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] import > > django.core.handlers.wsgi > > [Sat Feb 04 17:43:28 2012] [error] [client 127.0.0.1] ImportError: No > > module named django.core.handlers.wsgi > > > From command line python the import works: > > > $ python > > Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) > > [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > > >>> import django.core.handlers.wsgi > > > I also have this warning in the apache log: > > > [Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Compiled for Python/2.6.2. > > [Sat Feb 04 17:41:12 2012] [warn] mod_wsgi: Runtime using Python/ > > 2.6.6. > > > I've checked permissions, and wsgi.py and every dir in the path to it > > is 755. > > > Anyone know why my app isn't finding it? > > > TIA! > > -larry -- 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.core.handlers.wsgi not found
On Feb 5, 4:05 pm, Dennis Lee Bieber wrote: > On Sun, 5 Feb 2012 14:08:52 -0800 (PST), "larry.mart...@gmail.com" > > wrote: > > >It's exactly the same sys.path I get from command line python, where > >the import works. > > NO IT ISN'T! > > > > >['/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/ > > >['', '/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', > > Note the difference? The latter includes "current working directory" > as the first entry. Ok, I didn't notice that. However wouldn't the cwd be '.' and not an empty sting? In any case, when I try the import from command line python, I am not in the dir containing django.core.handlers.wsgi. -larry -- 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.core.handlers.wsgi not found
On Feb 5, 4:13 pm, "larry.mart...@gmail.com" wrote: > On Feb 5, 4:05 pm, Dennis Lee Bieber wrote: > > > > > > > > > On Sun, 5 Feb 2012 14:08:52 -0800 (PST), "larry.mart...@gmail.com" > > > wrote: > > > >It's exactly the same sys.path I get from command line python, where > > >the import works. > > > NO IT ISN'T! > > > >['/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/ > > > > >['', '/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', > > > Note the difference? The latter includes "current working directory" > > as the first entry. > > Ok, I didn't notice that. However wouldn't the cwd be '.' and not an > empty sting? In any case, when I try the import from command line > python, I am not in the dir containing django.core.handlers.wsgi. > > -larry > On Feb 5, 4:32 pm, Graham Dumpleton > wrote: > > At the start of the WSGI script file, add: > > import django > > print django.__file__ > > In other words, work out whether top level 'django' can be installed > > and if so where it is coming from. > > You might inadvertently have a django.py file sitting somewhere which > > it is finding by mistake. > When I add that I get: > [Mon Feb 06 06:36:57 2012] [error] [client 127.0.0.1] import > django > [Mon Feb 06 06:36:57 2012] [error] [client 127.0.0.1] ImportError: No > module named django > When I do the same from command like python I get: > $ python > Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) > [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import django > >>> print django.__file__ > /usr/lib/python2.6/site-packages/django/__init__.py > When I print sys.path from my wsgi script /usr/lib/python2.6/site- > packages is there. Does /usr/lib/python2.6/site-packages/django need > to be given somewhere? I re-installed django and that seems to have fixed the problem. Not sure why it did - I installed it the same way as I did before, but whatever, it works now. -larry -- 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.
dropdown select box in django
I'm fairly new to django, still getting my feet wet. I want to have a dropdown menu (django seems to call this a select box). I read this: https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.choices So I did this: class EventsTable(models.Model): EVENT_TYPE_CHOICES = ( ('Event Created', 'EventCreated'), ('Event Changed', 'EventChanged'), ) message = models.CharField("Event Type", max_length=12, choices=EVENT_TYPE_CHOICES) But I get a standard text entry field where I can type in anything. I did more googling, and I read a lot of confusing stuff about having to use javascrpt, ajax, CSS, etc. I read some pages about using a ChoiceField, but that is not part of the model class (it's in the forms class). I'm not sure how that would be used with a class that inherits form models. What am I missing here? I can't imagine something as common as this would be hard in django. Shouldn't the first thing I did work? TIA! -larry -- 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: dropdown select box in django
On Feb 20, 5:39 pm, Stanwin Siow wrote: > Try removing > > "Event Type", > > in the following > > message = models.CharField("Event Type", max_length=12, > choices=EVENT_TYPE_CHOICES) > > Best Regards, > > Stanwin Siow No difference. > > On Feb 21, 2012, at 8:32 AM, larry.mart...@gmail.com wrote: > > > > > > > > > ield("Event Type", max_length=12, > > choices=EVENT_TYPE_CHOICES) -- 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: dropdown select box in django
On Feb 20, 5:54 pm, Anurag Chourasia wrote: > This is weird > > I simply copy pasted your code in my environment and it shows me a Drop > Down. > > Could you save the models file again and close your browser (or even try > clearing cache) and restart your apache/django dev server whatever may be > the case and try again? Tried all that, still no joy. Also tried 2 different browsers, no difference. In the dev server also tried setting a breakpoint and then printing out message.choices, and it has the choices I expected: (Pdb) print message.choices (('Event Created', 'EventCreated'), ('Event Changed', 'EventChanged')) > > Regards, > Anurag > > On Mon, Feb 20, 2012 at 9:32 PM, larry.mart...@gmail.com < > > > > > > > > larry.mart...@gmail.com> wrote: > > I'm fairly new to django, still getting my feet wet. I want to have a > > dropdown menu (django seems to call this a select box). I read this: > > >https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mo... > > > So I did this: > > > class EventsTable(models.Model): > > EVENT_TYPE_CHOICES = ( > > ('Event Created', 'EventCreated'), > > ('Event Changed', 'EventChanged'), > > ) > > > message = models.CharField("Event Type", max_length=12, > > choices=EVENT_TYPE_CHOICES) > > > But I get a standard text entry field where I can type in anything. > > > I did more googling, and I read a lot of confusing stuff about having > > to use javascrpt, ajax, CSS, etc. I read some pages about using a > > ChoiceField, but that is not part of the model class (it's in the > > forms class). I'm not sure how that would be used with a class that > > inherits form models. > > > What am I missing here? I can't imagine something as common as this > > would be hard in django. Shouldn't the first thing I did work? > > > TIA! > > -larry > > > -- > > 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: dropdown select box in django
On Feb 20, 9:52 pm, Mario Gudelj wrote: > Hey there, > > Try this: > > In your forms.py create a field such as this > > message = forms.ChoiceField(label='Event Type', choices=EVENT_TYPE_CHOICES) > > That will create a dropdown. My app does not have a forms.py file. I know I can just create one, but then how would that field be scoped? I want it to be part of the EventsTable class. > Also, I think that the first thing in the tuple is a value and shouldn't > have a space, so change: > > EVENT_TYPE_CHOICES = (('Event Created', 'EventCreated'),('Event Changed', > 'EventChanged'),) > > to: > > EVENT_TYPE_CHOICES = (('event_created', 'Event Created'),('event_changed', > 'Event Changed'),) > > See if that works for you. Changing that did not have any effect. > > Cheers, > > -m > > message = models.CharField("Event Type", max_length=12, > > > > choices=EVENT_TYPE_CHOICES) > > On 21 February 2012 12:28, larry.mart...@gmail.com > wrote: > > > > > > > > > On Feb 20, 5:54 pm, Anurag Chourasia > > wrote: > > > This is weird > > > > I simply copy pasted your code in my environment and it shows me a Drop > > > Down. > > > > Could you save the models file again and close your browser (or even try > > > clearing cache) and restart your apache/django dev server whatever may be > > > the case and try again? > > > Tried all that, still no joy. Also tried 2 different browsers, no > > difference. In the dev server also tried setting a breakpoint and then > > printing out message.choices, and it has the choices I expected: > > > (Pdb) print message.choices > > (('Event Created', 'EventCreated'), ('Event Changed', 'EventChanged')) > > > > Regards, > > > Anurag > > > > On Mon, Feb 20, 2012 at 9:32 PM, larry.mart...@gmail.com < > > > > larry.mart...@gmail.com> wrote: > > > > I'm fairly new to django, still getting my feet wet. I want to have a > > > > dropdown menu (django seems to call this a select box). I read this: > > > > >https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mo. > > .. > > > > > So I did this: > > > > > class EventsTable(models.Model): > > > > EVENT_TYPE_CHOICES = ( > > > > ('Event Created', 'EventCreated'), > > > > ('Event Changed', 'EventChanged'), > > > > ) > > > > > message = models.CharField("Event Type", max_length=12, > > > > choices=EVENT_TYPE_CHOICES) > > > > > But I get a standard text entry field where I can type in anything. > > > > > I did more googling, and I read a lot of confusing stuff about having > > > > to use javascrpt, ajax, CSS, etc. I read some pages about using a > > > > ChoiceField, but that is not part of the model class (it's in the > > > > forms class). I'm not sure how that would be used with a class that > > > > inherits form models. > > > > > What am I missing here? I can't imagine something as common as this > > > > would be hard in django. Shouldn't the first thing I did work? > > > > > TIA! > > > > -larry > > > > > -- > > > > 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. -- 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: dropdown select box in django
On Feb 21, 6:11 am, Mario Gudelj wrote: > not sure what you mean there, I have a class that inherits from Model, and I want my field to be in that class. > but take a look at > thishttps://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield That looks to be for foreign key references. In my case the choices will be hard coded, as shown in my example code in my original post. > > On 21 February 2012 23:36, larry.mart...@gmail.com > wrote: > > > > > > > > > On Feb 20, 9:52 pm, Mario Gudelj wrote: > > > Hey there, > > > > Try this: > > > > In your forms.py create a field such as this > > > > message = forms.ChoiceField(label='Event Type', > > choices=EVENT_TYPE_CHOICES) > > > > That will create a dropdown. > > > My app does not have a forms.py file. I know I can just create one, > > but then how would that field be scoped? I want it to be part of the > > EventsTable class. > > > > Also, I think that the first thing in the tuple is a value and shouldn't > > > have a space, so change: > > > > EVENT_TYPE_CHOICES = (('Event Created', 'EventCreated'),('Event Changed', > > > 'EventChanged'),) > > > > to: > > > > EVENT_TYPE_CHOICES = (('event_created', 'Event > > Created'),('event_changed', > > > 'Event Changed'),) > > > > See if that works for you. > > > Changing that did not have any effect. > > > > Cheers, > > > > -m > > > > message = models.CharField("Event Type", max_length=12, > > > > > > choices=EVENT_TYPE_CHOICES) > > > > On 21 February 2012 12:28, larry.mart...@gmail.com > > > wrote: > > > > > On Feb 20, 5:54 pm, Anurag Chourasia > > > > wrote: > > > > > This is weird > > > > > > I simply copy pasted your code in my environment and it shows me a > > Drop > > > > > Down. > > > > > > Could you save the models file again and close your browser (or even > > try > > > > > clearing cache) and restart your apache/django dev server whatever > > may be > > > > > the case and try again? > > > > > Tried all that, still no joy. Also tried 2 different browsers, no > > > > difference. In the dev server also tried setting a breakpoint and then > > > > printing out message.choices, and it has the choices I expected: > > > > > (Pdb) print message.choices > > > > (('Event Created', 'EventCreated'), ('Event Changed', 'EventChanged')) > > > > > > Regards, > > > > > Anurag > > > > > > On Mon, Feb 20, 2012 at 9:32 PM, larry.mart...@gmail.com < > > > > > > larry.mart...@gmail.com> wrote: > > > > > > I'm fairly new to django, still getting my feet wet. I want to > > have a > > > > > > dropdown menu (django seems to call this a select box). I read > > this: > > >https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mo. > > > > .. > > > > > > > So I did this: > > > > > > > class EventsTable(models.Model): > > > > > > EVENT_TYPE_CHOICES = ( > > > > > > ('Event Created', 'EventCreated'), > > > > > > ('Event Changed', 'EventChanged'), > > > > > > ) > > > > > > > message = models.CharField("Event Type", max_length=12, > > > > > > choices=EVENT_TYPE_CHOICES) > > > > > > > But I get a standard text entry field where I can type in anything. > > > > > > > I did more googling, and I read a lot of confusing stuff about > > having > > > > > > to use javascrpt, ajax, CSS, etc. I read some pages about using a > > > > > > ChoiceField, but that is not part of the model class (it's in the > > > > > > forms class). I'm not sure how that would be used with a class that > > > > > > inherits form models. > > > > > > > What am I missing here? I can't imagine something as common as this > > > > > > would be hard in django. Shouldn't the first thing I did work? > > > > > > > TIA! > > > > > > -larry > > > > > > > -- > > > > > > You received this mess
Re: viewing generated SQL without running the query
On Feb 21, 7:32 pm, diafygi wrote: > There's a previous thread about this[1], but it was closed back in > 2006 without resolution. So I'd like to check back in and see if there > is a way to get a complete query string without executing the query. > > At first, I thought I could just use the QuerySet.query.__str__(), but > that does not put quotes around dates, so MySQL returns a warning when > trying to execute it. I filed a bug report[2], but apparently > QuerySet.query.__str__() isn't supposed to return a valid query > string. > > So is there a way to get the compiled query string without executing > the query (including when debug=False)? > > Thanks! > Daniel > > [1] -http://groups.google.com/group/django-users/browse_thread/thread/37a6... > [2] -https://code.djangoproject.com/ticket/17741 What I usually do is set a breakpoint with pdb at the appropriate place ('import pdb; pdb.set_trace()') then run the devel server, and then you hit the breakpoint do 'print queryset.query' There's also this: https://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running But I've never tried it. -larry -- 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.
Live search
I'm fairly new to django, still working on my first project. I have a page with some selection fields and a button. The user clicks the button, I run a query, and display the result set on the page. Works fine. Now I was to add a live search field to allow the user to further winnow down the result set. As they type in this field, the displayed result set will be filtered and re-displayed. But I can't figure out how to return control to my code as they type in that field. I assume I'll have to write some javascript code to get the events and collect the entered text, but how do I then pass that to my python code that would have the result set available to it? Or am I thinking about this wrong - do I have to do it all in javascript? Can anyone point me at an example that does something like this? TIA! -larry -- 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.
Getting a text field value to persist
I have a table that is created in a view like this (only the pertinent parts are shown): {% for row in page.object_list %} {% if forloop.first %} {% for value in row %} {% if forloop.first %} {{ value }} {% else %} {{ value }} {% endfor %} {% else % } {% endif %} {% endfor %} There are buttons on the page that cause the page to be regenerated. When that happens the text that the user may have entered in the filterValue field is lost. Is there some way (perhaps with javascript) that I can save that value and then initialize the field to it within the above code? -- 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.
Getting URL from within a template
>From within a template can I find out the URL that caused the template to be invoked? -- 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: Adding link to admin page
On Mar 25, 3:29 pm, Larry Martell wrote: > I have a client that has an app built with django. On every page of > their app is a link to their admin site. They tell me the admin site > is generated entirely by django, and they've never customized it > before. On the very first line of the admin page it says: > > Django administration Welcome, admin. Change password / Log out > > They want me to add a link to that line, to the left of "Django > administration" that will take them back to the page they were on when > they clicked on the link to get them to the admin site. > > So I have 2 issues here: > > 1) How do I override that line to add the link? It appears that page > is generated by contrib/admin/templates/admin/base.html, and I tried > to override it by following the directions > athttps://docs.djangoproject.com/en/1.2/ref/contrib/admin/#overriding-a..., > but whatever I do seems to have no effect. > > 2) How can I get the link of the page of the app they came from? It's > not simply just going back one page, as they could have navigated all > over the place of the admin site before clicking the "Back to app" > link. > > Thanks! > -larry Is there anyone that can provide some assistance with overriding base_site.html? I copied django/contrib/admin/templates/admin/ base_site.html to my projects's templates/admin dir, but changes to it are not getting picked up. I also tried adding that to TEMPLATE_DIRS (there was nothing in it before). In urlpatterns I have: (r'^admin/', include(admin.site.urls)) - does that need to change? -- 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.
Problem getting django on mac (10.5/Leopard) working
I am trying to get django working on my mac. I downloaded it from SVN to /usr/local/django-trunk and it's there: $ ls /usr/local/django-trunk/ __init__.py corehttptemplatetags bin db middleware test confdispatchshortcuts utils contrib forms templateviews I updated my site-packages with a django.pth file: $ cat /Library/Python/2.5/site-packages/django.pth /usr/local/django-trunk python does have this dir in its path: $ python -c "import sys; print sys.path" ['', '/Library/Python/2.5/site-packages/cx_Oracle-5.0.2-py2.5- macosx-10.5-i386.egg', '/System/Library/Frameworks/Python.framework/ Versions/2.5/lib/python25.zip', '/System/Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5', '/System/Library/ Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/ System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.5/ lib/python2.5/plat-mac/lib-scriptpackages', '/System/Library/ Frameworks/Python.framework/Versions/2.5/Extras/lib/python', '/System/ Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib- tk', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/usr/ local/django-trunk', '/System/Library/Frameworks/Python.framework/ Versions/2.5/Extras/lib/python/PyObjC'] But I still can't import it: $ python Python 2.5.1 (r251:54863, May 5 2011, 18:37:34) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import django Traceback (most recent call last): File "", line 1, in ImportError: No module named django What am I missing or doing wrong? TIA! -larry -- 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: Problem getting django on mac (10.5/Leopard) working
On Jan 7, 7:03 pm, David Markey wrote: > Is there a reason you didnt do easy_install django? Cause I didn't know about it. I just followed the directions I found at: https://docs.djangoproject.com/en/dev/topics/install/ Is there some reason that wouldn't work? > > On 8 January 2012 01:50, larry.mart...@gmail.com > wrote: > > > > > > > > > I am trying to get django working on my mac. I downloaded it from SVN > > to /usr/local/django-trunk and it's there: > > > $ ls /usr/local/django-trunk/ > > __init__.py core http templatetags bin > > db middleware test > > conf dispatch shortcuts utils > > contrib forms > > template views > > > I updated my site-packages with a django.pth file: > > > $ cat /Library/Python/2.5/site-packages/django.pth > > /usr/local/django-trunk > > > python does have this dir in its path: > > > $ python -c "import sys; print sys.path" > > ['', '/Library/Python/2.5/site-packages/cx_Oracle-5.0.2-py2.5- > > macosx-10.5-i386.egg', '/System/Library/Frameworks/Python.framework/ > > Versions/2.5/lib/python25.zip', '/System/Library/Frameworks/ > > Python.framework/Versions/2.5/lib/python2.5', '/System/Library/ > > Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/ > > System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > > plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.5/ > > lib/python2.5/plat-mac/lib-scriptpackages', '/System/Library/ > > Frameworks/Python.framework/Versions/2.5/Extras/lib/python', '/System/ > > Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib- > > tk', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > > python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/usr/ > > local/django-trunk', '/System/Library/Frameworks/Python.framework/ > > Versions/2.5/Extras/lib/python/PyObjC'] > > > But I still can't import it: > > > $ python > > Python 2.5.1 (r251:54863, May 5 2011, 18:37:34) > > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import django > > Traceback (most recent call last): > > File "", line 1, in > > ImportError: No module named django > > > What am I missing or doing wrong? > > > TIA! > > -larry > > > -- > > 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: Problem getting django on mac (10.5/Leopard) working
On Jan 7, 7:13 pm, "larry.mart...@gmail.com" wrote: > On Jan 7, 7:03 pm, David Markey wrote: > > > Is there a reason you didnt do easy_install django? > > Cause I didn't know about it. I just followed the directions I found > at: > > https://docs.djangoproject.com/en/dev/topics/install/ > > Is there some reason that wouldn't work? I solved this by creating a symlink from /Library/Python/2.5/site- packages/django to my django install dir. Still not sure why that worked and putting the path in django.pth did not. > > On 8 January 2012 01:50, larry.mart...@gmail.com > > wrote: > > > > I am trying to get django working on my mac. I downloaded it from SVN > > > to /usr/local/django-trunk and it's there: > > > > $ ls /usr/local/django-trunk/ > > > __init__.py core http templatetags bin > > > db middleware test > > > conf dispatch shortcuts utils > > > contrib forms > > > template views > > > > I updated my site-packages with a django.pth file: > > > > $ cat /Library/Python/2.5/site-packages/django.pth > > > /usr/local/django-trunk > > > > python does have this dir in its path: > > > > $ python -c "import sys; print sys.path" > > > ['', '/Library/Python/2.5/site-packages/cx_Oracle-5.0.2-py2.5- > > > macosx-10.5-i386.egg', '/System/Library/Frameworks/Python.framework/ > > > Versions/2.5/lib/python25.zip', '/System/Library/Frameworks/ > > > Python.framework/Versions/2.5/lib/python2.5', '/System/Library/ > > > Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/ > > > System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > > > plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.5/ > > > lib/python2.5/plat-mac/lib-scriptpackages', '/System/Library/ > > > Frameworks/Python.framework/Versions/2.5/Extras/lib/python', '/System/ > > > Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib- > > > tk', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > > > python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/usr/ > > > local/django-trunk', '/System/Library/Frameworks/Python.framework/ > > > Versions/2.5/Extras/lib/python/PyObjC'] > > > > But I still can't import it: > > > > $ python > > > Python 2.5.1 (r251:54863, May 5 2011, 18:37:34) > > > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > > > Type "help", "copyright", "credits" or "license" for more information. > > > >>> import django > > > Traceback (most recent call last): > > > File "", line 1, in > > > ImportError: No module named django > > > > What am I missing or doing wrong? > > > > TIA! > > > -larry > > > > -- > > > 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: html in django password_reset_email.html
On Tuesday, November 2, 2010 5:50:49 AM UTC-4, Tom Evans wrote: > > On Tue, Nov 2, 2010 at 9:07 AM, andy > > wrote: > > I recently tried to send the following in a test password email from a > > site I am creating: > > > > This is a test reset password email. > > > > However when I received the email it displayed the "This is a test > > reset password email.". > > > > My question is how can I send a styled email using html tags and > > possibly even css when using the password_reset_email.html template > > that goes with django's view.password_reset? > > > > I don't know about the specifics of your particular issues, but to > send HTML emails: > > Create an instance of django.core.mail.EmailMultiAlternatives, passing > in your subject, text version of the email, from address, list of > recipients. Render your HTML version of the email, and attach it to > the email, and then send it. > > eg: > > from django.core.mail import EmailMultiAlternatives > msg = EmailMultiAlternatives('Subject', 'This is the text version', > 'fr...@address.com ', [ 'recip...@address.com > ',]) > html_version = ... > msg.attach_alternative(html_version, 'text/html') > msg.send() > I am having the same issue, but it's not clear to me how to implement your solution. I have added the files password_reset_email.html, activation_email_subject.txt, password_reset_form.html, and password_reset_done.html to my ui/templates/registration dir customized them as needed. Where would I put your code above? Where would I call it from? Thanks! -larry -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/XWUCrdk3uagJ. 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.