admin complains when adding a new User
I must be missing something simple. Just using the admin interface, adding a user, and clicking Save elicits this: Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/django/core/servers/basehttp.py", line 272, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.4/site-packages/django/core/servers/basehttp.py", line 611, in __call__ return self.application(environ, start_response) File "/usr/local/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 148, in __call__ response = self.get_response(request.path, request) File "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py", line 59, in get_response response = middleware_method(request) File "/usr/local/lib/python2.4/site-packages/django/middleware/common.py", line 43, in process_request raise RuntimeError, "You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to %s%s (note the trailing slash), or set APPEND_SLASH=False in your Django settings." % (new_url[0], new_url[1]) RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to localhost:8000/admin/auth/user/add/-TEMPLATE-VARIABLE-IS-MISSING-/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: admin complains when adding a new User
If I set APPEND_SLASH=False in my settings.py, then I see this POST at the end of my log: [20/Sep/2006 03:28:15] "POST /admin/auth/user/add/-TEMPLATE-VARIABLE-IS-MISSING- HTTP/1.1" 404 4838 Not sure if this gives any further clues. BTW, I svn update everyday, and try things on either the main trunk, or per-object-permissions branch. Same error either way, in this case. /Nara --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Model-level DB cache
I have a similar problem, though I am using PostgreSQL 8.1.3). I run a unittest that creates a bunch of records against the database, all of it using django and the model API. This runs fine the first time, but shows the following stack trace on subsequent runs. It seems to hit the problem at the very first instance it is querying the database, on my second run of unittest This could be from an unfinished transaction from the first run, though, again, I don't explicitly do any transactions. I have to drop my DB, and reload all my data to clear the error! Traceback (most recent call last): File "/home/nara/ws/juglr/trunk/juglr/common/group/unittest.py", line 116, in ? unittest() File "/home/nara/ws/juglr/trunk/juglr/common/group/unittest.py", line 95, in u nittest fake_groups(7) File "/home/nara/ws/juglr/trunk/juglr/common/group/unittest.py", line 46, in f ake_groups curlen = len(Group.objects.all()) File "/usr/local/lib/python2.4/site-packages/django/db/models/query.py", line 100, in __len__ return len(self._get_data()) File "/usr/local/lib/python2.4/site-packages/django/db/models/query.py", line 430, in _get_data self._result_cache = list(self.iterator()) File "/usr/local/lib/python2.4/site-packages/django/db/models/query.py", line 170, in iterator cursor = connection.cursor() File "/usr/local/lib/python2.4/site-packages/django/db/backends/postgresql_psy copg2/base.py", line 47, in cursor cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) psycopg2.ProgrammingError: current transaction is aborted, commands ignored unti l end of transaction block /Nara Michael Radziej wrote: > Greg Plesur schrieb: > > So that's a work-around that I can use, but...is it okay behavior? That > > seems pretty broken. Is it possible that Django's DB connection has > > auto-commit off, but explicitly calls COMMIT internally on save() > > operations when there's no Django-level transaction in play? > > Looking at it like a database does, at least in theory, > everything happens in a transaction. auto-commit is only an > illusion ... or the database is broken in a fundamental way. > > Django probably does start a transaction somewhere, I don't know. > Try to trace your session and you'll see. > > Within the normal server http transactions, you don't get this > error. I have not seen it before. There are some settings in the > transaction documentation that might be worth playing with if it > gets in your way. Usually, it does not ... > > And, this turned out to be a really interesting question ;-) > > Michael --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Model-level DB cache
wasn't a DB cache issue in my case, just a bug in my model code. The first run of unittest silently failed, and subsequent ones showed the above stack trace. Running stuff in the python interpreter helped find the problem. I do a connection._rollback() at the start of my unittest now, as insurance. /Nara --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
newbie question on activating the automatic admin
Hi, I am a newbie, and I am trying a very basic blog site to get familiar with the latest development release. I followed the directions in the tutorial (part 2) to try and get the automatic admin going. However, here is what I get on the url localhost:8000/admin/ DoesNotExist at /admin/ Site matching query does not exist. Request Method: GET Request URL:http://localhost:8000/admin/ Django Version: 1.4 pre-alpha SVN-16741 Exception Type: DoesNotExist Exception Value: Site matching query does not exist. Further, syncdb, even on a brand new database, does not create tables for the admin, just for django and my blog model. Ideas, suggestions? Thanks Nara -- 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: newbie question on activating the automatic admin
yes, admin is in INSTALLED_APPS. BTW, the basic site works fine if I turn off all admin. admin is not strictly necessary, it is just a nicety. One strange thing though: I have had to set PYTHONPATH and explicitly set it to ~/mblog:~/mblog/apps:~/mblog/apps/myblog, even though __init__.py files exist at all levels! Could something as basic as Python module search be broken? I am using latest Python 2.7 on Ubuntu 11.04 Thanks Nara On Sep 9, 5:35 pm, Casey Greene wrote: > Is admin in INSTALLED_APPS? > > https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTA... > > Casey > > On 09/09/2011 07:04 PM, nara wrote: > > > > > > > > > Hi, > > > I am a newbie, and I am trying a very basic blog site to get familiar > > with the latest development release. I followed the directions in the > > tutorial (part 2) to try and get the automatic admin going. However, > > here is what I get on the url localhost:8000/admin/ > > > DoesNotExist at /admin/ > > > Site matching query does not exist. > > > Request Method: GET > > Request URL: http://localhost:8000/admin/ > > Django Version: 1.4 pre-alpha SVN-16741 > > Exception Type: DoesNotExist > > Exception Value: > > > Site matching query does not exist. > > > Further, syncdb, even on a brand new database, does not create tables > > for the admin, just for django and my blog model. > > > Ideas, suggestions? > > > Thanks > > Nara -- 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: newbie question on activating the automatic admin
I'll get through this yet :) I tried the commands you have under the django shell, and I got 'example.com' on the django.Site query, and not an error. Also, interestingly, within the shell, I don't see django on the sys.path at all (shown below), but I do see my project mblog. This could be the cause of not seeing the admin. I could switch to python 2.6 instead of python 2.7, but I doubt that that is going fix this issue. Dropping my project table and doing a new syncdb did not help either. Here is the path, prettified: ['/home/nara/dj/mblog' '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg' '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg' '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg' '/usr/lib/python2.7' '/usr/lib/python2.7/plat-linux2' '/usr/lib/python2.7/lib-tk' '/usr/lib/python2.7/lib-old' '/usr/lib/python2.7/lib-dynload' '/usr/local/lib/python2.7/dist-packages' '/usr/lib/python2.7/dist-packages' '/usr/lib/python2.7/dist-packages/PIL' '/usr/lib/pymodules/python2.7/gtk-2.0' '/usr/lib/python2.7/dist-packages/gst-0.10' '/usr/lib/python2.7/dist-packages/gtk-2.0' '/usr/lib/pymodules/python2.7' '/usr/lib/pymodules/python2.7/ubuntuone-control-panel' '/usr/lib/pymodules/python2.7/libubuntuone' '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol' '/usr/lib/pymodules/python2.7/ubuntuone-client'] Thanks Nara On Sep 9, 9:56 pm, Babatunde Akinyanmi wrote: > Hi nara, > This error is normally thrown when the sites app is being used in a > django project. I think it can also occur if the sites tables in the > database is not properly created during django-admin startproject. > Someone else reported that he was able to solve the problem by using a > user name without special characters. > > This might be difficult to debug since you are using a development > version however: > 1. Go to the inbuilt django shell and enter these commands: > from django.contrib.sites.models import Site > From django.conf import settings > x = settings.SITE_ID > Site.objects.get(pk=x) > > You should get the same "site matching query does not exist" error. > Now print x and then check the django_site_table in your database. x > should be the same as the primary key of what you have in the table. > If it isn't, drop the table and syncdb again. > > On 9/10/11, nara wrote: > > > > > > > > > > > yes, admin is in INSTALLED_APPS. BTW, the basic site works fine if I > > turn > > off all admin. admin is not strictly necessary, it is just a nicety. > > > One strange thing though: I have had to set PYTHONPATH and > > explicitly set it to ~/mblog:~/mblog/apps:~/mblog/apps/myblog, > > even though __init__.py files exist at all levels! Could > > something as basic as Python module search be broken? > > I am using latest Python 2.7 on Ubuntu 11.04 > > > Thanks > > Nara > > > On Sep 9, 5:35 pm, Casey Greene wrote: > >> Is admin in INSTALLED_APPS? > > >>https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTA... > > >> Casey > > >> On 09/09/2011 07:04 PM, nara wrote: > > >> > Hi, > > >> > I am a newbie, and I am trying a very basic blog site to get familiar > >> > with the latest development release. I followed the directions in the > >> > tutorial (part 2) to try and get the automatic admin going. However, > >> > here is what I get on the url localhost:8000/admin/ > > >> > DoesNotExist at /admin/ > > >> > Site matching query does not exist. > > >> > Request Method: GET > >> > Request URL: http://localhost:8000/admin/ > >> > Django Version: 1.4 pre-alpha SVN-16741 > >> > Exception Type: DoesNotExist > >> > Exception Value: > > >> > Site matching query does not exist. > > >> > Further, syncdb, even on a brand new database, does not create tables > >> > for the admin, just for django and my blog model. > > >> > Ideas, suggestions? > > >> > Thanks > >> > Nara > > > -- > > 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. > > -- > Sent from my mobile device -- 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: newbie question on activating the automatic admin
ok, I switched to the 1.3.1 released version of Django, and also tried Python2.6 instead of Python2.7 on the dev version of Django. Things are still majorly broken, see the following in the django shell on a fresh startproject, I could not import even the top level django module. Then, I set PYTHONPATH to /home/nara/Django1.3/django, and after that, in the shell, I am still unable to directly import the admin module, I have to do this: >>> import django >>> import django.contrib >>> import django.contrib.admin So, the problem is not just in the admin module, it is likely all over the place (entire django module hierarchy). Oh well, looks like I have to cool this off for a while. Thanks for everyone's help. Nara On Sep 10, 2:17 pm, nara wrote: > I'll get through this yet :) > > I tried the commands you have under the django shell, and I got > 'example.com' > on the django.Site query, and not an error. Also, interestingly, > within the shell, I don't see > django on the sys.path at all (shown below), but I do see my project > mblog. This could > be the cause of not seeing the admin. I could switch to python 2.6 > instead > of python 2.7, but I doubt that that is going fix this issue. Dropping > my project > table and doing a new syncdb did not help either. > > Here is the path, prettified: > > ['/home/nara/dj/mblog' > '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg' > '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg' > '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg' > '/usr/lib/python2.7' > '/usr/lib/python2.7/plat-linux2' > '/usr/lib/python2.7/lib-tk' > '/usr/lib/python2.7/lib-old' > '/usr/lib/python2.7/lib-dynload' > '/usr/local/lib/python2.7/dist-packages' > '/usr/lib/python2.7/dist-packages' > '/usr/lib/python2.7/dist-packages/PIL' > '/usr/lib/pymodules/python2.7/gtk-2.0' > '/usr/lib/python2.7/dist-packages/gst-0.10' > '/usr/lib/python2.7/dist-packages/gtk-2.0' > '/usr/lib/pymodules/python2.7' > '/usr/lib/pymodules/python2.7/ubuntuone-control-panel' > '/usr/lib/pymodules/python2.7/libubuntuone' > '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol' > '/usr/lib/pymodules/python2.7/ubuntuone-client'] > > Thanks > Nara > > On Sep 9, 9:56 pm, Babatunde Akinyanmi wrote: > > > > > > > > > Hi nara, > > This error is normally thrown when the sites app is being used in a > > django project. I think it can also occur if the sites tables in the > > database is not properly created during django-admin startproject. > > Someone else reported that he was able to solve the problem by using a > > user name without special characters. > > > This might be difficult to debug since you are using a development > > version however: > > 1. Go to the inbuilt django shell and enter these commands: > > from django.contrib.sites.models import Site > > From django.conf import settings > > x = settings.SITE_ID > > Site.objects.get(pk=x) > > > You should get the same "site matching query does not exist" error. > > Now print x and then check the django_site_table in your database. x > > should be the same as the primary key of what you have in the table. > > If it isn't, drop the table and syncdb again. > > > On 9/10/11, nara wrote: > > > > yes, admin is in INSTALLED_APPS. BTW, the basic site works fine if I > > > turn > > > off all admin. admin is not strictly necessary, it is just a nicety. > > > > One strange thing though: I have had to set PYTHONPATH and > > > explicitly set it to ~/mblog:~/mblog/apps:~/mblog/apps/myblog, > > > even though __init__.py files exist at all levels! Could > > > something as basic as Python module search be broken? > > > I am using latest Python 2.7 on Ubuntu 11.04 > > > > Thanks > > > Nara > > > > On Sep 9, 5:35 pm, Casey Greene wrote: > > >> Is admin in INSTALLED_APPS? > > > >>https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-INSTA... > > > >> Casey > > > >> On 09/09/2011 07:04 PM, nara wrote: > > > >> > Hi, > > > >> > I am a newbie, and I am trying a very basic blog site to get familiar > > >> > with the latest development release. I followed the directions in the > > >> > tutorial (part 2) to try and get the automatic admin going. However, > > >
Re: newbie question on activating the automatic admin
ok, i am planning to remove all traces of all django installations from my system, and re-install the dev version (and if that still does not work 3.1) under virtualenv. Will repost here if I still see problems. Nara On Sep 10, 7:16 pm, Babatunde Akinyanmi wrote: > Hi nara, > Please post the debug output you get when you try to view the admin > page from your browser. > > Meanwhile, while switching versions of django, you have to make sure > you remove completely every file from the old version. Failure to do > that will break django. > > On 9/10/11, nara wrote: > > > > > > > > > > > ok, I switched to the 1.3.1 released version of Django, and > > also tried Python2.6 instead of Python2.7 on the dev version > > of Django. Things are still majorly broken, see the following > > in the django shell on a fresh startproject, I could not > > import even the top level django module. Then, > > I set PYTHONPATH to /home/nara/Django1.3/django, > > and after that, in the shell, I am still unable to > > directly import the admin module, I have to do this: > > >>>> import django > >>>> import django.contrib > >>>> import django.contrib.admin > > > So, the problem is not just in the admin module, it > > is likely all over the place (entire django module hierarchy). > > > Oh well, looks like I have to cool this off for a while. > > > Thanks for everyone's help. > > Nara > > > On Sep 10, 2:17 pm, nara wrote: > >> I'll get through this yet :) > > >> I tried the commands you have under the django shell, and I got > >> 'example.com' > >> on the django.Site query, and not an error. Also, interestingly, > >> within the shell, I don't see > >> django on the sys.path at all (shown below), but I do see my project > >> mblog. This could > >> be the cause of not seeing the admin. I could switch to python 2.6 > >> instead > >> of python 2.7, but I doubt that that is going fix this issue. Dropping > >> my project > >> table and doing a new syncdb did not help either. > > >> Here is the path, prettified: > > >> ['/home/nara/dj/mblog' > >> '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg' > >> '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg' > >> '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg' > >> '/usr/lib/python2.7' > >> '/usr/lib/python2.7/plat-linux2' > >> '/usr/lib/python2.7/lib-tk' > >> '/usr/lib/python2.7/lib-old' > >> '/usr/lib/python2.7/lib-dynload' > >> '/usr/local/lib/python2.7/dist-packages' > >> '/usr/lib/python2.7/dist-packages' > >> '/usr/lib/python2.7/dist-packages/PIL' > >> '/usr/lib/pymodules/python2.7/gtk-2.0' > >> '/usr/lib/python2.7/dist-packages/gst-0.10' > >> '/usr/lib/python2.7/dist-packages/gtk-2.0' > >> '/usr/lib/pymodules/python2.7' > >> '/usr/lib/pymodules/python2.7/ubuntuone-control-panel' > >> '/usr/lib/pymodules/python2.7/libubuntuone' > >> '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol' > >> '/usr/lib/pymodules/python2.7/ubuntuone-client'] > > >> Thanks > >> Nara > > >> On Sep 9, 9:56 pm, Babatunde Akinyanmi wrote: > > >> > Hi nara, > >> > This error is normally thrown when the sites app is being used in a > >> > django project. I think it can also occur if the sites tables in the > >> > database is not properly created during django-admin startproject. > >> > Someone else reported that he was able to solve the problem by using a > >> > user name without special characters. > > >> > This might be difficult to debug since you are using a development > >> > version however: > >> > 1. Go to the inbuilt django shell and enter these commands: > >> > from django.contrib.sites.models import Site > >> > From django.conf import settings > >> > x = settings.SITE_ID > >> > Site.objects.get(pk=x) > > >> > You should get the same "site matching query does not exist" error. > >> > Now print x and then check the django_site_table in your database. x > >> > should be the same as the primary key of what you have in the table. > >> > If it isn't, drop the table and syn
Re: newbie question on activating the automatic admin
Finally! The admin interface worked, when I used the dev version in a virtualenv. I cleaned every trace of Django in my system, and I had to compile (requires python-dev package in Ubuntu) and install MySQLdb into the virtualenv. Not sure what exactly was wrong before, but Babatunde's suggestion that I had mixed up code installed (some in system files, and also mixed Django1.3 and the dev release) seems like the best guess. Thanks for everyone's help ;) Nara On Sep 11, 10:44 pm, Babatunde Akinyanmi wrote: > And reply here if you don't see problems :) > > On 9/12/11, nara wrote: > > > > > > > > > > > ok, i am planning to remove all traces of all django installations > > from my > > system, and re-install the dev version (and if that still does not > > work 3.1) > > under virtualenv. > > > Will repost here if I still see problems. > > > Nara > > > On Sep 10, 7:16 pm, Babatunde Akinyanmi wrote: > >> Hi nara, > >> Please post the debug output you get when you try to view the admin > >> page from your browser. > > >> Meanwhile, while switching versions of django, you have to make sure > >> you remove completely every file from the old version. Failure to do > >> that will break django. > > >> On 9/10/11, nara wrote: > > >> > ok, I switched to the 1.3.1 released version of Django, and > >> > also tried Python2.6 instead of Python2.7 on the dev version > >> > of Django. Things are still majorly broken, see the following > >> > in the django shell on a fresh startproject, I could not > >> > import even the top level django module. Then, > >> > I set PYTHONPATH to /home/nara/Django1.3/django, > >> > and after that, in the shell, I am still unable to > >> > directly import the admin module, I have to do this: > > >> >>>> import django > >> >>>> import django.contrib > >> >>>> import django.contrib.admin > > >> > So, the problem is not just in the admin module, it > >> > is likely all over the place (entire django module hierarchy). > > >> > Oh well, looks like I have to cool this off for a while. > > >> > Thanks for everyone's help. > >> > Nara > > >> > On Sep 10, 2:17 pm, nara wrote: > >> >> I'll get through this yet :) > > >> >> I tried the commands you have under the django shell, and I got > >> >> 'example.com' > >> >> on the django.Site query, and not an error. Also, interestingly, > >> >> within the shell, I don't see > >> >> django on the sys.path at all (shown below), but I do see my project > >> >> mblog. This could > >> >> be the cause of not seeing the admin. I could switch to python 2.6 > >> >> instead > >> >> of python 2.7, but I doubt that that is going fix this issue. Dropping > >> >> my project > >> >> table and doing a new syncdb did not help either. > > >> >> Here is the path, prettified: > > >> >> ['/home/nara/dj/mblog' > >> >> '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg' > >> >> '/usr/local/lib/python2.7/dist-packages/grin-1.2.1-py2.7.egg' > >> >> '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg' > >> >> '/usr/lib/python2.7' > >> >> '/usr/lib/python2.7/plat-linux2' > >> >> '/usr/lib/python2.7/lib-tk' > >> >> '/usr/lib/python2.7/lib-old' > >> >> '/usr/lib/python2.7/lib-dynload' > >> >> '/usr/local/lib/python2.7/dist-packages' > >> >> '/usr/lib/python2.7/dist-packages' > >> >> '/usr/lib/python2.7/dist-packages/PIL' > >> >> '/usr/lib/pymodules/python2.7/gtk-2.0' > >> >> '/usr/lib/python2.7/dist-packages/gst-0.10' > >> >> '/usr/lib/python2.7/dist-packages/gtk-2.0' > >> >> '/usr/lib/pymodules/python2.7' > >> >> '/usr/lib/pymodules/python2.7/ubuntuone-control-panel' > >> >> '/usr/lib/pymodules/python2.7/libubuntuone' > >> >> '/usr/lib/pymodules/python2.7/ubuntuone-storage-protocol' > >> >> '/usr/lib/pymodules/python2.7/ubuntuone-client'] > > >> >> Thanks > >> >> Nar
can't get STATICFILES to work (Django dev version)
I am having trouble getting static files to work, and have to resort to putting all my css inline (ugly!). I have read and followed the docs on static files. django.contrib.staticfiles is in INSTALLED_APPS (by default), and I have set STATICFILES_DIRS to where my static files are (/home/nara/media). (I have tried with and without a slash at the end of this absolute file path). Running the dev server, looks like none of my css files are getting pulled in, the logs always show an HTTP response of 200, and looking at the results in firebug on firefox 6.0.2, both screen.css and print.css, my static files, are empty. I am confused about whether ./manage.py collectstatic is a necessary step for static files to work, I didn't think so, and have not done that. Thanks Nara -- 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.
can't get STATICFILES to work (Django dev version)
I am having trouble getting STATICFILES to work. I have read the docs, and followed the instructions, but I never get my css files to load. My current workaround is to put all the css inline in my template file, but that should not be a permanent solution. I am running the django dev version, and I am using the built-in server. Here are my changes: 1. I placed my media (css) files under /home/nara/media 2. I added '/home/nara/media' under STATICFILES_DIRS (django.contrib.staticfiles is already in INSTALLED_APPS) 3. I added {{STATIC_URL}} (no spaces) in front of the reference to static files in my template file. 4. I restarted the server. No further changes. I don't have additional copies of the static files anywhere else, such us under my project, or app. Looking at the result in firebug within firefox, I get an HTTP response of 200 on my css files (happen to be css/blueprint/screen.css and print.css), but the files are null. Clearing the cache, restarting Firefox etc. do not help. I have been fighting this issue for several days now, and have tried many things, but the above description is for my current state. Thanks Nara -- 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: can't get STATICFILES to work (Django dev version)
Xavier, I followed the blog, and at the end, my css files were not getting pulled in. I then tried doing a ./manage.py collectstatic, and this does collect all static files. Unfortunately, running the server still does not serve my css files. I have spent too many cycles on this issue now. I will go back to my workaround of just placing css inline in the templates, and later, use Apache on my local machine to serve the css files. Thanks Nara On Sep 25, 2:44 pm, Xavier Ordoquy wrote: > Hi, > > > I have read and followed the docs on static files. > > django.contrib.staticfiles is in INSTALLED_APPS > > (by default), and I have set STATICFILES_DIRS to where my static files > > are (/home/nara/media). (I have > > tried with and without a slash at the end of this absolute file path). > > Static files aren't media. You should keep them separated. > > > I am confused about whether ./manage.py collectstatic is a necessary > > step for static files to work, I didn't think so, and have not done > > that. > > It isn't if you aren't on production stage (ie, DEBUG=False). > > I have started a post on how to setup static files. It isn't finished yet but > might help you to set it > up:http://www.linovia.com/blog/django-staticfiles-howto/ > > Regards, > Xavier. -- 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: can't get STATICFILES to work (Django dev version)
Good news, my static files finally work. (I wanted to make one last try before giving up). Bottom line, I did not have to make any changes to my original settings.py or urls.py. All I did: created a static dir. under my app's directory, placed the css files under it, and put '/static/css/blueprint/screen.css' to refer to the external css. That was it. Here is the head section of my template file, list.html: Thanks Nara On Sep 26, 6:02 pm, nara wrote: > Xavier, > > I followed the blog, and at the end, my css files were not getting > pulled in. > I then tried doing a ./manage.py collectstatic, and this does collect > all > static files. Unfortunately, running the server still does not serve > my > css files. > > I have spent too many cycles on this issue now. I will go back to my > workaround of just placing css inline in the templates, and later, > use Apache on my local machine to serve the css files. > > Thanks > Nara > > On Sep 25, 2:44 pm, Xavier Ordoquy wrote: > > > > > > > > > Hi, > > > > I have read and followed the docs on static files. > > > django.contrib.staticfiles is in INSTALLED_APPS > > > (by default), and I have set STATICFILES_DIRS to where my static files > > > are (/home/nara/media). (I have > > > tried with and without a slash at the end of this absolute file path). > > > Static files aren't media. You should keep them separated. > > > > I am confused about whether ./manage.py collectstatic is a necessary > > > step for static files to work, I didn't think so, and have not done > > > that. > > > It isn't if you aren't on production stage (ie, DEBUG=False). > > > I have started a post on how to setup static files. It isn't finished yet > > but might help you to set it > > up:http://www.linovia.com/blog/django-staticfiles-howto/ > > > Regards, > > Xavier. -- 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: can't get STATICFILES to work (Django dev version)
No, I had Debug=True. Xavier, you have a good point, my understanding of STATICFILES is still foggy, and I do have confusion between media and static files. However, I have to make some progress on the rest of my code. I will revisit this when I have some cycles, but for sure, when I try to use a non-development server, such as apache. Thanks Nara On Oct 1, 1:00 pm, Jian Chang wrote: > Did you set Debug=False? > 在 2011-9-27 上午4:21,"nara" 写道: > > > > > > > > > I am having trouble getting STATICFILES to work. I have read the docs, > > and followed the instructions, but I never get my css files to load. > > My current workaround is to put all the css inline in my template > > file, but that should not be a permanent solution. > > > I am running the django dev version, and I am using the built-in > > server. Here are my changes: > > > 1. I placed my media (css) files under /home/nara/media > > 2. I added '/home/nara/media' under STATICFILES_DIRS > > (django.contrib.staticfiles is already in INSTALLED_APPS) > > 3. I added {{STATIC_URL}} (no spaces) in front of the reference to > > static files in my template file. > > 4. I restarted the server. > > > No further changes. I don't have additional copies of the static files > > anywhere else, such > > us under my project, or app. > > > Looking at the result in firebug within firefox, I get an HTTP > > response of 200 on my css files > > (happen to be css/blueprint/screen.css and print.css), but the files > > are null. Clearing > > the cache, restarting Firefox etc. do not help. > > > I have been fighting this issue for several days now, and have tried > > many things, > > but the above description is for my current state. > > > Thanks > > Nara > > > -- > > 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: admin complains when adding a new User
OK, It is because I had a non-empty string in settings.py forTEMPLATE_STRING_IF_INVALID,namely, TEMPLATE_STRING_IF_INVALID='-TEMPLATE -VARIABLE-IS-MISSING-'Setting to "" # empty string worked around the problem.I see now that there is already a ticket for this: http://code.djangoproject.com/ticket/2566 That's all for now :)/NaraOn 9/19/06, nara <[EMAIL PROTECTED]> wrote: If I setAPPEND_SLASH=Falsein my settings.py,then I see this POST at the end of my log: [20/Sep/2006 03:28:15] "POST/admin/auth/user/add/-TEMPLATE-VARIABLE-IS-MISSING- HTTP/1.1" 404 4838Not sure if this gives any further clues.BTW, I svn update everyday, and try things on either the main trunk, or per-object-permissions branch.Same error either way, in this case./Nara --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---