Django configuration. I can't import django.db .
Hi I've installed python 2.5.2 into D:\P25 folder. Then i installed diango using python setup.py install. After that, when i typed: >>> import django everything was ok, but when i type: >>> import diango.db i get the following message: Traceback (most recent call last): File "", line 1, in File "d:\P25\Lib\site-packages\django\db\__init__.py", line 9, in if not settings.DATABASE_ENGINE: File "d:\P25\Lib\site-packages\django\conf\__init__.py", line 28, in __getattr __ self._import_settings() File "d:\P25\Lib\site-packages\django\conf\__init__.py", line 59, in _import_s ettings self._target = Settings(settings_module) File "d:\P25\Lib\site-packages\django\conf\__init__.py", line 94, in __init__ raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e) ImportError: Could not import settings 'D:\P5\Lib\site-packages \django;D:\P25\Li b\site-packages;D:\P25;D:\P5\Lib\site-packages\django\bin;D:\P5\Lib \site-package s\django\bin\mysite;;D:\P5\Scripts\mysite' (Is it on sys.path? Does it have synt ax errors?): No module named D:\P5\Lib\site-packages\django;D:\P25\Lib \site-pack ages;D:\P25;D:\P5\Lib\site-packages\django\bin;D:\P5\Lib\site-packages \django\bi n\mysite;;D:\P5\Scripts\mysite I also tried with Python2.6, but it didn't work too. I searched tchrought the internet, but I didn't find any help. What is the solution for this problem ? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Using fixtures in tests
Yes, you're right. I just assumed that if the info about loading initial_data is printed that there will be printed info for non- initial-data fixtures too. On Aug 17, 11:53 am, Karen Tracey wrote: > On Mon, Aug 17, 2009 at 11:10 AM, Marek Wawrzyczek > wrote: > > > > > > > Hi, > > > I've got an application called myapp > > > In the main folder of django project there is initial_data.json file > > containing initial data for the application > > I also have file "simplefix.json" situated in myapp/fixtures > > containing initial data for tests > > > Then after calling: python manage.py test myapp: > > > the following output is shown: > > > (...creating tables and indexes) > > > Installing json fixture 'initial_data' from absolute path. > > Installed 114 object(s) from 1 fixture(s) > > hello > > > myapp/tests.py has the following content: > > > from django.test import TestCase > > > class SimpleTestCase(TestCase): > > > fixtures = ['simplefix.json'] > > > def testOne(self): > > print 'hello' > > > How can I load database during tests from defined fixture? I tried > > putting simplefix.json in myapp/ in main project folder, in fixtures > > directory in main project folder and none of that worked > > What you have shown (with simplefix.json in your app's fixtures directory) > should be working. How are you determining that it isn't? Note there is no > feedback printed for non-initial-data fixtures loaded during testing, so you > won't see a message for simplefix.json as you do for the initial data > fixture. > > If you are determining that it isn't working because your test code can't > access data that should have been loaded, then I'd suspect a typo in the > file name somewhere. Unfortunately there is also no feedback for this case, > so double check that you've got the file with the right name, and specified > the right name in the TestCase fixtures attribute. > > Karen --~--~-~--~~~---~--~~ 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 custom table instead of "user" in django
How about writting adapter to the django user class? It can have descriptor for login (getting login would return users email). While creating such user login would be set (only once, during creation) for example the following value: user id converted to string preceded by one character. For other custom fields there can be also descriptors, but they would reffer to yours customer model (for example adapters field homepage which would be descriptor would reffer to customer.homepage). Regards, Marek On 17 Sie, 19:05, Joshua Partogi wrote: > On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist wrote: > > > Here's what I did: > > > I took the built in auth system and changed it a bit, or to be more > > precise I changed all imports within auth (because I moved it within the > > pythonpath) and edited models.py: > > >http://dpaste.com/81651/ > > > Whole code: > > >http://www.ojii.ch/auth.tar.gz > > > If you wanna use it: > > > Add the folder in the archive to your pythonpath. > > > Add 'auth' to your installed applications > > > Set 'USER_MODEL' in your settings file to the model you use (string). > > Is it better to re-write the user model or to extend it? Any insights? > > Thanks in advance > > --http://blog.scrum8.comhttp://twitter.com/scrum8 --~--~-~--~~~---~--~~ 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 custom table instead of "user" in django
How about writting adapter to the django user class? It can have descriptor for login (getting login would return users email). While creating such user login would be set (only once, during creation) for example the following value: user id converted to string preceded by one character. For other custom fields there can be also descriptors, but they would reffer to yours customer model (for example adapters field homepage which would be descriptor would reffer to customer.homepage). Regards, Marek On 17 Sie, 19:05, Joshua Partogi wrote: > On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist wrote: > > > Here's what I did: > > > I took the built in auth system and changed it a bit, or to be more > > precise I changed all imports within auth (because I moved it within the > > pythonpath) and edited models.py: > > >http://dpaste.com/81651/ > > > Whole code: > > >http://www.ojii.ch/auth.tar.gz > > > If you wanna use it: > > > Add the folder in the archive to your pythonpath. > > > Add 'auth' to your installed applications > > > Set 'USER_MODEL' in your settings file to the model you use (string). > > Is it better to re-write the user model or to extend it? Any insights? > > Thanks in advance > > --http://blog.scrum8.comhttp://twitter.com/scrum8 --~--~-~--~~~---~--~~ 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 custom table instead of "user" in django
How about writting adapter to the django user class? It can have descriptor for login (getting login would return users email). While creating such user login would be set (only once, during creation) for example the following value: user id converted to string preceded by one character. For other custom fields there can be also descriptors, but they would reffer to yours customer model (for example adapters field homepage which would be descriptor would reffer to customer.homepage). Regards, Marek On 17 Sie, 19:05, Joshua Partogi wrote: > On Mon, Aug 17, 2009 at 10:40 PM, Jonas Obrist wrote: > > > Here's what I did: > > > I took the built in auth system and changed it a bit, or to be more > > precise I changed all imports within auth (because I moved it within the > > pythonpath) and edited models.py: > > >http://dpaste.com/81651/ > > > Whole code: > > >http://www.ojii.ch/auth.tar.gz > > > If you wanna use it: > > > Add the folder in the archive to your pythonpath. > > > Add 'auth' to your installed applications > > > Set 'USER_MODEL' in your settings file to the model you use (string). > > Is it better to re-write the user model or to extend it? Any insights? > > Thanks in advance > > --http://blog.scrum8.comhttp://twitter.com/scrum8 --~--~-~--~~~---~--~~ 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: HttpResponseRedirect
So when returning HttpResponseRedirect django returns 302 status code for the client, which indicates that the client browser should navigate to another url. Then you have at last 2 options: 1) before returning save at session data information about form that you want to thans form - but it's not very good, because it can work wrong when same user will be entering 2 different forms at the same session 2) return address with get parameters inside, and then in thanks page's view check that get parameters to determine the form from which the user was redirected On 6 Sie, 14:33, bagheera wrote: > I have two pages with two different forms. Each, if validated, redirects > to "thanks" page. I want to customize this behavior, so "thanks" page > should display different message, regarding witch form was invoked, or > redirects to "/' if no redirection took place (like user typed in browser > "test.com/thanks") > Unfortunately, HttpResponseRedirect takes only one argument. How can i > pass right message anyway? Or mb there is some workaround, like i could > check in "thanks" view, from what page it was redirected? > > -- > Linux user -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: HttpResponseRedirect
Daniel, I think it can work incorrectly when user would be filling more than one form of the same type at the same time. My suggestion is to use passing get parameters while returning HttpResponseRedirect. It of course have disadvantage that the address would not be always same (get params will be different for different types of forms) but it won't cause problems described above. On 6 Sie, 15:20, Daniel Roseman wrote: > On Aug 6, 1:33 pm, bagheera wrote: > > > I have two pages with two different forms. Each, if validated, redirects > > to "thanks" page. I want to customize this behavior, so "thanks" page > > should display different message, regarding witch form was invoked, or > > redirects to "/' if no redirection took place (like user typed in browser > > "test.com/thanks") > > Unfortunately, HttpResponseRedirect takes only one argument. How can i > > pass right message anyway? Or mb there is some workaround, like i could > > check in "thanks" view, from what page it was redirected? > > > -- > > Linux user > > Store something in the session when you validate the form before > redirecting. > -- > DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Value Error in Pyfacebook
At the end of the stacktrace there's written: ValueError: invalid literal for int() with base 10: 'None' You can debug that code and see what happens. On Aug 7, 10:20 pm, Pankaj Singh wrote: > Hi i m getting this error > > *** > Traceback (most recent call last): > > File "/usr/local/alwaysdata/python/ > django/1.2.1/django/core/handlers/base.py", line 100, in get_response > response = callback(request, *callback_args, **callback_kwargs) > > File > "/usr/local/alwaysdata/python/django/1.2.1/django/utils/decorators.py", line > 76, in _wrapped_view > response = view_func(request, *args, **kwargs) > > File "", line 1, in > > File "/home/pankajsingh/company_site/fbapp/facebook/djangofb/__init__.py", > line 94, in newview > return view(request, *args, **kwargs) > > File "/home/pankajsingh/company_site/fbapp/views.py", line 23, in canvas > user = User.objects.get_current() > > File "/home/pankajsingh/company_site/fbapp/models.py", line 13, in > get_current > user, created = self.get_or_create(id=int(facebook.uid)) > > ValueError: invalid literal for int() with base 10: 'None' > *** > > need help to get out of this > > -- > -- > -- > Thanking You, > > Pankaj Kumar Singh, > 3rd Year Undergraduate Student, > Department of Agricultural and Food Engineering, > Indian Institute of Technology, > Kharagpur > > Mobile - (+91) 8001231685 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Value Error in Pyfacebook
At the end of the stacktrace there's written: ValueError: invalid literal for int() with base 10: 'None' You can debug that code and see what happens. On Aug 7, 10:20 pm, Pankaj Singh wrote: > Hi i m getting this error > > *** > Traceback (most recent call last): > > File "/usr/local/alwaysdata/python/ > django/1.2.1/django/core/handlers/base.py", line 100, in get_response > response = callback(request, *callback_args, **callback_kwargs) > > File > "/usr/local/alwaysdata/python/django/1.2.1/django/utils/decorators.py", line > 76, in _wrapped_view > response = view_func(request, *args, **kwargs) > > File "", line 1, in > > File "/home/pankajsingh/company_site/fbapp/facebook/djangofb/__init__.py", > line 94, in newview > return view(request, *args, **kwargs) > > File "/home/pankajsingh/company_site/fbapp/views.py", line 23, in canvas > user = User.objects.get_current() > > File "/home/pankajsingh/company_site/fbapp/models.py", line 13, in > get_current > user, created = self.get_or_create(id=int(facebook.uid)) > > ValueError: invalid literal for int() with base 10: 'None' > *** > > need help to get out of this > > -- > -- > -- > Thanking You, > > Pankaj Kumar Singh, > 3rd Year Undergraduate Student, > Department of Agricultural and Food Engineering, > Indian Institute of Technology, > Kharagpur > > Mobile - (+91) 8001231685 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 with AJAX, execution of long processes
You can spawn another process in system, and save identification data of that process in users's session, and then query django for status of the process. I guess you can also implement long pooling in django to query for status of the process. But generally if talking about long pooling it's worth to consider asynchronus web server (like twisted). On Aug 7, 8:08 pm, Rohan Jain wrote: > Hi! > > I have a problem with django and ajax. > I am giving requests from ajax which run a process that takes some > time and has many stages. Is there any way to return the various > stages as responses, so the user does not have to see only the loading > image but can also the current status of the process. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 with AJAX, execution of long processes
You can spawn another process in system, and save identification data of that process in users's session, and then query django for status of the process. I guess you can also implement long pooling in django to query for status of the process. But generally if talking about long pooling it's worth to consider asynchronus web server (like twisted). On Aug 7, 8:08 pm, Rohan Jain wrote: > Hi! > > I have a problem with django and ajax. > I am giving requests from ajax which run a process that takes some > time and has many stages. Is there any way to return the various > stages as responses, so the user does not have to see only the loading > image but can also the current status of the process. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.