Re: Exception Value: No module named url -- on django poll tutorial
HEYY K1G, You've got it this is a typical case of trees not letting me see the forest Thanks a lot for your eagles eye ;-) El viernes, 9 de agosto de 2013 00:56:11 UTC+2, ke1g escribió: > > > > > On Thu, Aug 8, 2013 at 4:18 PM, goreano >wrote: > >> Here is the full error trace >> > > >> ... >> > > >> Traceback: >> File >> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in >> get_response >> 103. resolver_match = >> resolver.resolve(request.path_info) >> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" >> in resolve >> 319. for pattern in self.url_patterns: >> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" >> in url_patterns >> 347. patterns = getattr(self.urlconf_module, "urlpatterns", >> self.urlconf_module) >> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" >> in urlconf_module >> 342. self._urlconf_module = import_module(self.urlconf_name) >> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" >> in import_module >> 35. __import__(name) >> File >> "/home/amarinetto/Dropbox/formacion/Python/Django/proyectos/mysite/mysite/urls.py" >> >> in >> 19. url(r'^polls/', include('polls.url')) >> > > Your root urls.py, line 19 should say: > url(r'^polls/', include('polls.urls')) > That is, the character before the last single quote on the line should be > 's'. > > File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" >> in include >> 25. urlconf_module = import_module(urlconf_module) >> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" >> in import_module >> 35. __import__(name) >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Friendship model
On Thu, Aug 8, 2013 at 12:41 PM, Robin Lery wrote: > How do i create a Friendship model? Please guide me. > You would need to provide more detail to get much help. The tutorial covers how to make models: https://docs.djangoproject.com/en/dev/intro/tutorial01/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: connecting to MS SQL server in addition to default MySQL
I just have read-only access to the MS SQL server database. I can't install anything on the Windows box. So all I can do is execute sql queries against it. On Thu, Aug 8, 2013 at 9:19 AM, Michael Manfre wrote: > Any particular reason you want to completely avoid the ORM? My main project > that uses django-mssql started off with a lot of raw queries (including > stored procedure calls) to work with the legacy business database. It was a > maintenance headache and one of the main reasons I added support to > django-mssql to allow using resultsets generated by stored procedures with > Django's raw command [1]. > > To work directly with mssql from linux, you'll probably want to use pyodbc > [2]. If running Django on windows, you can either use pyodbc or install > django-mssql and execute raw queries. > > [1] > http://django-mssql.readthedocs.org/en/latest/usage.html#rawstoredproceduremanager > [2] https://code.google.com/p/pyodbc/ > > Regards, > Michael Manfre > > On Wednesday, August 7, 2013 1:42:48 PM UTC-4, larry@gmail.com wrote: >> >> I have a django app that connects to a MySQL server in the usual way. >> I've noe been asked to add some new functionality that requires that I >> pull data from a MS SQL server database running on a Windows box. I >> don't want to use the django ORM with the db, just access it directly >> with some sql in my python code. What's the best way to accomplish >> this? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: NuoDB released 1.2 along with a Django Driver
On Thu, Aug 8, 2013 at 7:51 AM, Russell Keith-Magee wrote: > > This is deeply concerning -- from my initial inspection of the code, it's > pretty clear that the NuoDB backend has been substantially copied from > Django's postgresql_psycopg2 backend. > > The code in the Django postgresql_psycogpy2 backend, like all of Django, > is covered by Django's BSD license, which requires attribution of the > copyright to: > > Copyright (c) Django Software Foundation and individual contributors. > All rights reserved. > > The DSF takes this copyright very seriously. While I'm enthusiastic about > the prospect of a new database supporting Django, that can't be at the cost > of the Django community losing it's intellectual property rights. Lindsey > -- I'll be in touch shortly in my capacity as DSF President to discuss this > issue. > Good news -- I contacted NuoDB, and they responded quickly to correct the oversight. The LICENSE file for the NuoDB Django backend [1] now acknowledges the original copyright of the Django contributors. [1] https://github.com/nuodb/nuodb-django/blob/master/LICENSE Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Why can't a Model have the same name as a View?
On 9/08/2013 4:13am, JJ Zolper wrote: Hello everyone, I've only been working with Python and Django for a couple of years now and whenever I can I like to learn more about certain rationalizations for certain decisions made within each of them. In Django we define a Python class with a name to represent our model (I think it's a python class at least) and then we write "def" for definition of a view function or python function. To me I view this as two separate types of structures and thus fairly often I give a model the same name as a view. It isn't until later that I realize that my app isn't working because of the fact that they have the same name. I'm here just wondering if anyone would be willing to explain how this comes about from how Python/Django treats this instance? Why does Django see a confliction between a class and a function with the same name? Aren't they entirely separate entities? I'm by all means okay with going in and changing the names of the view or model to something slightly different so everything works, I just would like to understand conceptually why it is an issue? Python uses namespaces a lot including inside a package, module, class and inside a def and if you bring two objects with the same name into the same namespace things will break. However, you can do it if you don't import the object but instead preface it with its namespace. For example: foo(a model) and views.foo(a view) Google for python namespace and you should see some good info. hth Thanks a lot, JJ Zolper -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Exception Value: No module named url -- on django poll tutorial
On Thu, Aug 8, 2013 at 4:18 PM, goreano wrote: > Here is the full error trace > > ... > > Traceback: > File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" > in get_response > 103. resolver_match = > resolver.resolve(request.path_info) > File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" > in resolve > 319. for pattern in self.url_patterns: > File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" > in url_patterns > 347. patterns = getattr(self.urlconf_module, "urlpatterns", > self.urlconf_module) > File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" > in urlconf_module > 342. self._urlconf_module = import_module(self.urlconf_name) > File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in > import_module > 35. __import__(name) > File > "/home/amarinetto/Dropbox/formacion/Python/Django/proyectos/mysite/mysite/urls.py" > in > 19. url(r'^polls/', include('polls.url')) > Your root urls.py, line 19 should say: url(r'^polls/', include('polls.urls')) That is, the character before the last single quote on the line should be 's'. File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" > in include > 25. urlconf_module = import_module(urlconf_module) > File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in > import_module > 35. __import__(name) > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Why can't a Model have the same name as a View?
Python variables don't have types. They're just references. You can call models and views by the same name. But a bare name can only have one value in a given python scope. Thus, if in your views.py you do: from models import Foo you have set the view module's global scope's variable 'Foo' to be a reference to that imported (presumably) models.Model subclass. If later you do: def Foo(request): ... then you have stored a new value in the view module's global scope's variable 'Foo', a reference to a function. Which you will get upon reference depends on when (temporally, not lexically) you make the reference with respect to when the function got defined. On the other hand, you could do: import models def Foo(request): ... And later 'Foo' will always refer to the function while 'models.Foo' will always refer to the class. Of course, the accepted convention is to name functions and methods all lower case (or beginning with a lower case letter, at least, while class names begin with an upper case letter. If you follow this community standard, your issue never arises. If you insist on bringing the naming conventions of another language into python, realize that other folks won't want to work on, review, or help with your code. Bill On Thu, Aug 8, 2013 at 2:13 PM, JJ Zolper wrote: > Hello everyone, > > I've only been working with Python and Django for a couple of years now > and whenever I can I like to learn more about certain rationalizations for > certain decisions made within each of them. > > In Django we define a Python class with a name to represent our model (I > think it's a python class at least) and then we write "def" for definition > of a view function or python function. To me I view this as two separate > types of structures and thus fairly often I give a model the same name as a > view. It isn't until later that I realize that my app isn't working because > of the fact that they have the same name. I'm here just wondering if anyone > would be willing to explain how this comes about from how Python/Django > treats this instance? Why does Django see a confliction between a class and > a function with the same name? Aren't they entirely separate entities? > > I'm by all means okay with going in and changing the names of the view or > model to something slightly different so everything works, I just would > like to understand conceptually why it is an issue? > > Thanks a lot, > > JJ Zolper > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Exception Value: Could not parse the remainder: '().order_by('-votes')' from 'poll.altword_set.all().order_by('-votes')'
I'm still a bit confused how to make my ordering work, I can't find examples that order things the way I want :( 1.) My webpage now look like this after playing with the Viewpage. *localhost:8000/navi_polls/madara/1/* Page * Page - Leafy 2 = 18 votes * Page - Leafy 3 = 50 votes * Paper - Leaf = 300 votes * Page - Leafy 3 = 50 votes * Page - Leafy 2 = 18 votes * Paper - Leafy = 0 votes 2.) *altword_list.html* {{ poll.rosword }} {% for choice in poll.altword_set.all %} {{ choice.rosword }} - {{ choice.alt_ros_word }} - {{ choice.alt_transl_word }} - {{ choice.articulate }} = {{ choice.votes }} votes {% endfor %} {% for choice in filter_4b %} {{ choice.rosword }} - {{ choice.alt_ros_word }} - {{ choice.alt_transl_word }} - {{ choice.articulate }} = {{ choice.votes }} votes {% endfor %} 3.) How can I make Filter 5 behave like Filter 4b? 4.) *index.html* Filter 2 (Word) {% if filter_2 %} {% for row in filter_2 %} {{ row.rosword }} {% endfor %} {% else %} No polls are available. {% endif %} 5.) *IndexView* class IndexView(generic.ListView): template_name = 'navi_polls/index.html' context_object_name = 'latest_poll_list' def get_queryset(self): # Filter 1 """ Return the last five published polls (not including those set to be published in the future). """ return Word.objects.filter(pub_date__lte=timezone.now() ).order_by('-pub_date')[:5] #""" #Return the last five published polls #(including those set to be published in the future). #""" #return Word.objects.order_by('-pub_date')[:5] def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) # Filter 2 filter_2 = Word.objects.filter(direct_transl_word='') # Filter 4 filter_4 = Altword.objects.filter(rosword__direct_transl_word='') context.update({ "filter_2": filter_2, "filter_4": filter_4 }) return context 6.) *AltwordlistView* class AltwordlistView(generic.DetailView): model = Word template_name = 'navi_polls/altword_list.html' context_object_name = 'poll' def get_queryset(self): #""" #Excludes any polls that aren't published yet. #""" #return Word.objects.filter(pub_date__lte=timezone.now()) # Filter 5 return Word.objects.filter(direct_transl_word='') #return Altword.objects.filter(rosword__direct_transl_word='') def get_context_data(self, **kwargs): context = super(AltwordlistView, self).get_context_data(**kwargs) # Filter 4b filter_4b = Altword.objects.filter(rosword__direct_transl_word='').order_by('-votes') context.update({ "filter_4b": filter_4b }) return context 7.) *Models* class Word(models.Model): rosword = models.CharField(max_length=200) direct_transl_word = models.CharField(max_length=120, blank=True, null=True) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.rosword def was_published_recently(self): now = timezone.now() return now - datetime.timedelta(days=1) <= self.pub_date < now # Enables future date selection. #return self.pub_date >= timezone.now() - datetime.timedelta(days=1) was_published_recently.admin_order_field = 'pub_date' was_published_recently.boolean = True was_published_recently.short_description = 'Published recently?' #___ class Altword(models.Model): rosword = models.ForeignKey(Word) alt_ros_word = models.CharField(max_length=200) alt_transl_word = models.CharField(max_length=200) articulate = models.CharField(max_length=200) votes = models.IntegerField(default=0) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.alt_ros_word #___ On Wednesday, August 7, 2013 11:59:38 PM UTC+2, Pepsodent Cola wrote: > > Hi, > I have some database query ordering problems. > > 1.) > On my webpage I see this output: > > * Option-1 = 18 votes > * Option-2 = 50 votes > > > 2.) > *altword_list.html* > > > {% for choice2 in poll.altword_set.all %} > > {{ choice2.rosword }} - {{ choice2.alt_ros_word }} - {{ > choice2.alt_transl_word }} - {{ choice2.articulate }} = {{ choice2.votes }} > votes > {% endfor %} > > > > 3.) > I want my webpage to order the output by *most votes down to least votes*like > so: > > * Option-2 = 50 votes > * Option-1 = 18 votes > > > 4.) > In Python shell I managed to accomplish that by doing like so: > > >>> p = Word.objects.get(pk=1) > >>> p > > >>> p.altword_set.all() > [, ] > > >>> *p.altword_set.all().order_by('votes')* > [, ] > > > 5.) > How come when
Re: Exception Value: No module named url -- on django poll tutorial
Thanks, thas was a good try, im sure it is path related, THX VM El jueves, 8 de agosto de 2013 15:26:42 UTC+2, Mike Dewhirst escribió: > > Sorry - I didn't look past your settings ROOT_URLCONF > > Nor did I see that others have responded. Please disregard mine. > > Cheers > > Mike > > On 8/08/2013 11:20pm, Mike Dewhirst wrote: > > On 8/08/2013 5:53pm, goreano wrote: > >> Hi, > >> > >> I'm a newbie diving into django I've found a problem I've been hitting > >> my head against for the last 2 days. > >> > >> I think it is a path issue, actually I get the same error as i try to > >> open any URL on localhost:8000 > >> > >> Can you please give me a hint... I have to improve my path definition > >> skills but I'm stuck here: > >> > >> I get an error: > >> / > >> / > >> > >> > >> /ImportError at // > >> > >> // > >> > >> /No module named url/ > > > > This is the clue ... see below in your settings the ROOT_URLCONF value > > which is where Django looks to see if the url sent by the browser can be > > recognised (via matching to a Python regular expression) and if so, > > which view code to execute. > > > > So, that ROOT_URLCONF might include other named url modules (other > > whatever.py files with (url matching to view) urls you want to satisfy. > > > > By convention ROOT_URLCONF points to urls.py in the same directory as > > the settings.py file but it doesn't have to. > > > > If you are new to Django it can be somewhat confusing understanding the > > paths involved. I found it valuable to print out all the paths if DEBUG > > == True. Seeing them all permanently displayed by the dev server just > > kept reminding me where they were and made debugging static file > > locations and template dirs etc so easy. > > > > Hth > > > >> > >> // > >> /Request Method:/ /GET/ > >> /Request URL:/ /http://localhost:8000// > >> /Django Version:/ /1.5/ > >> /Exception Type:/ /ImportError/ > >> /Exception Value:/ > >> > >> /No module named url/ > >> > >> /Exception Location:/ > >> //usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in > >> import_module, line 35/ > >> /Python Executable:/ //usr/bin/python2.7/ > >> /Python Version:/ /2.7.3/ > >> /Python Path:/ > >> > >> /['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', > >> > >> > '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', > > > >> > >> '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', > >> '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', > >> '/usr/lib/python2.7/dist-packages/gtk-2.0', > >> '/usr/lib/pymodules/python2.7', > >> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', > >> '/usr/lib/python2.7/dist-packages/ubuntuone-client', > >> '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', > >> '/usr/lib/python2.7/dist-packages/ubuntuone-couch', > >> '/usr/lib/python2.7/dist-packages/ubuntuone-installer', > >> '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', > >> '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', > >> '/usr/lib/python2.7/dist-packages/django']/ > >> > >> /Server time:/ /Thu, 8 Aug 2013 09:34:16 +0200/ > >> > >> > >> > >> this is my settings file > >> > >> /import os > >> > >> BASE_DIR = os.path.dirname(os.path.abspath(__file__)) > >> > >> DEBUG = True > >> TEMPLATE_DEBUG = DEBUG > >> > >> ADMINS = ( ) > >> > >> MANAGERS = ADMINS > >> > >> DATABASES = { > >> 'default': { > >> 'ENGINE': 'django.db.backends.mysql', # Add > >> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. > >> 'NAME': 'polls', # Or path to database > >> file if using sqlite3. > >> # The following settings are not used with sqlite3: > >> 'USER': 'django', > >> 'PASSWORD': 'password', > >> 'HOST': '', # Empty for localhost through > >> domain sockets or '127.0.0.1' for localhost through TCP. > >> 'PORT': '', # Set to empty string for > >> default. > >> } > >> } > >> > >> ALLOWED_HOSTS = [] > >> > >> TIME_ZONE = 'Europe/Madrid' > >> > >> > >> LANGUAGE_CODE = 'en-us' > >> > >> SITE_ID = 1 > >> > >> USE_I18N = True > >> > >> > >> USE_L10N = True > >> > >> USE_TZ = True > >> > >> MEDIA_ROOT = '' > >> > >> MEDIA_URL = '' > >> > >> STATIC_ROOT = '' > >> > >> STATIC_URL = '/static/' > >> > >> STATICFILES_DIRS = () > >> > >> > >> STATICFILES_
Re: Exception Value: No module named url -- on django poll tutorial
Well, what typo is it El jueves, 8 de agosto de 2013 15:15:35 UTC+2, pa xapy escribió: > > you have a typo in the urls.py -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Exception Value: No module named url -- on django poll tutorial
Here is the full error trace Environment: Request Method: GET Request URL: http://localhost:8000/admin/ Django Version: 1.5 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'polls') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 103. resolver_match = resolver.resolve(request.path_info) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve 319. for pattern in self.url_patterns: File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns 347. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module 342. self._urlconf_module = import_module(self.urlconf_name) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module 35. __import__(name) File "/home/amarinetto/Dropbox/formacion/Python/Django/proyectos/mysite/mysite/urls.py" in 19. url(r'^polls/', include('polls.url')) File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include 25. urlconf_module = import_module(urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module 35. __import__(name) Exception Type: ImportError at /admin/ Exception Value: No module named url El jueves, 8 de agosto de 2013 15:05:18 UTC+2, ke1g escribió: > > Isn't there a stacktrace that goes with that error message? > > > On Thu, Aug 8, 2013 at 3:53 AM, goreano >wrote: > >> Hi, >> >> I'm a newbie diving into django I've found a problem I've been hitting my >> head against for the last 2 days. >> >> I think it is a path issue, actually I get the same error as i try to >> open any URL on localhost:8000 >> >> Can you please give me a hint... I have to improve my path definition >> skills but I'm stuck here: >> >> I get an error: >> * >> **ImportError at /** * >> >> *No module named url* >> >> * * *Request Method:* *GET* *Request URL:* *http://localhost:8000/* >> *Django >> Version:* *1.5* *Exception Type:* *ImportError* *Exception Value:* >> >> *No module named url* >> >> *Exception Location:* >> */usr/local/lib/python2.7/dist-packages/django/utils/importlib.py >> in import_module, line 35* *Python Executable:* */usr/bin/python2.7* >> *Python >> Version:* *2.7.3* *Python Path:* >> >> *['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', >> >> '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', >> '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', >> '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', >> '/usr/lib/python2.7/dist-packages/gtk-2.0', >> '/usr/lib/pymodules/python2.7', >> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', >> '/usr/lib/python2.7/dist-packages/ubuntuone-client', >> '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', >> '/usr/lib/python2.7/dist-packages/ubuntuone-couch', >> '/usr/lib/python2.7/dist-packages/ubuntuone-installer', >> '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', >> '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', >> '/usr/lib/python2.7/dist-packages/django']* >> >> *Server time:* *Thu, 8 Aug 2013 09:34:16 +0200* >> >> this is my settings file >> >> *import os >> >> BASE_DIR = os.path.dirname(os.path.abspath(__file__)) >> >> DEBUG = True >> TEMPLATE_DEBUG = DEBUG >> >> ADMINS = ( ) >> >> MANAGERS = ADMINS >> >> DATABASES = { >> 'default': { >> 'ENGINE': 'django.db.backends.mysql', # Add >> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. >> 'NAME': 'polls', # Or path to database file >> if using sqlite3. >> # The following settings are not used with sqlite3: >> 'USER': 'django', >> 'PASSWORD': 'password', >> 'HOST': '', # Empty for localhost through >> domain sockets or '127.0.0.1' for localhost through TCP. >> 'PORT': '',
Friendship model
Hi, How do i create a Friendship model? Please guide me. Thank you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Testing with legacy data
I'm not a fan of testing with actual data, except maybe as a final run to make sure no existing data breaks something or for stress testing with large amounts of data. Your legacy DB will not cover all of the possible cases that need to be tested in your code. Instead, write quality unit tests and functional tests that try all scenarios using factory boy or a similar data generator. My 2¢ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Why can't a Model have the same name as a View?
Hello everyone, I've only been working with Python and Django for a couple of years now and whenever I can I like to learn more about certain rationalizations for certain decisions made within each of them. In Django we define a Python class with a name to represent our model (I think it's a python class at least) and then we write "def" for definition of a view function or python function. To me I view this as two separate types of structures and thus fairly often I give a model the same name as a view. It isn't until later that I realize that my app isn't working because of the fact that they have the same name. I'm here just wondering if anyone would be willing to explain how this comes about from how Python/Django treats this instance? Why does Django see a confliction between a class and a function with the same name? Aren't they entirely separate entities? I'm by all means okay with going in and changing the names of the view or model to something slightly different so everything works, I just would like to understand conceptually why it is an issue? Thanks a lot, JJ Zolper -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Parents can't enroll children in courses
I submitted this question in much, much more detail a couple of weeks ago but got no response. I'm thinking that maybe I gave you too much information. So, I thought I'd try just one more time. I have a table of family members. Some of them are students. These students are enrolled in one or more courses. I can't seem to create the necessary view to allow a parent to enroll his child or children into one or more courses. Ideally, I'd like to present him with a list of courses for each period and allow him to select only one course for each child for each period. The tables look something like this. The Schedule table is a table that contains Foreign Keys to other tables (about 10 of them). It contains NO other fields besides these foreign keys. class FamilyMember(AbstractUser): family = models.ForeignKey(Family, blank=True, null=True) family_member_role = models.ForeignKey(FamilyMemberRole, blank=True, null=True)#For our example, let's assume this is either a parent or a child ... class Student(models.Model): ... family_member = models.OneToOneField(FamilyMember) class Schedule(models.Model): ... semester = models.ForeignKey(Semester, verbose_name='Semester') student = models.ManyToManyField(Student, verbose_name='Students', blank=True, null=True) ... -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: connecting to MS SQL server in addition to default MySQL
Any particular reason you want to completely avoid the ORM? My main project that uses django-mssql started off with a lot of raw queries (including stored procedure calls) to work with the legacy business database. It was a maintenance headache and one of the main reasons I added support to django-mssql to allow using resultsets generated by stored procedures with Django's raw command [1]. To work directly with mssql from linux, you'll probably want to use pyodbc [2]. If running Django on windows, you can either use pyodbc or install django-mssql and execute raw queries. [1] http://django-mssql.readthedocs.org/en/latest/usage.html#rawstoredproceduremanager [2] https://code.google.com/p/pyodbc/ Regards, Michael Manfre On Wednesday, August 7, 2013 1:42:48 PM UTC-4, larry@gmail.com wrote: > > I have a django app that connects to a MySQL server in the usual way. > I've noe been asked to add some new functionality that requires that I > pull data from a MS SQL server database running on a Windows box. I > don't want to use the django ORM with the db, just access it directly > with some sql in my python code. What's the best way to accomplish > this? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Exception Value: No module named url -- on django poll tutorial
hello , you forgot to add the library in urls.py *from django.conf.urls import patterns, include, url* Le jeudi 8 août 2013 08:53:14 UTC+1, goreano a écrit : > > Hi, > > I'm a newbie diving into django I've found a problem I've been hitting my > head against for the last 2 days. > > I think it is a path issue, actually I get the same error as i try to open > any URL on localhost:8000 > > Can you please give me a hint... I have to improve my path definition > skills but I'm stuck here: > > I get an error: > * > **ImportError at /** * > > *No module named url* > > * * *Request Method:* *GET* *Request URL:* *http://localhost:8000/* *Django > Version:* *1.5* *Exception Type:* *ImportError* *Exception Value:* > > *No module named url* > > *Exception Location:* > */usr/local/lib/python2.7/dist-packages/django/utils/importlib.py > in import_module, line 35* *Python Executable:* */usr/bin/python2.7* > *Python > Version:* *2.7.3* *Python Path:* > > *['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', > > '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', > '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', > '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', > '/usr/lib/python2.7/dist-packages/gtk-2.0', > '/usr/lib/pymodules/python2.7', > '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', > '/usr/lib/python2.7/dist-packages/ubuntuone-client', > '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', > '/usr/lib/python2.7/dist-packages/ubuntuone-couch', > '/usr/lib/python2.7/dist-packages/ubuntuone-installer', > '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', > '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', > '/usr/lib/python2.7/dist-packages/django']* > > *Server time:* *Thu, 8 Aug 2013 09:34:16 +0200* > > this is my settings file > > *import os > > BASE_DIR = os.path.dirname(os.path.abspath(__file__)) > > DEBUG = True > TEMPLATE_DEBUG = DEBUG > > ADMINS = ( ) > > MANAGERS = ADMINS > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', > 'mysql', 'sqlite3' or 'oracle'. > 'NAME': 'polls', # Or path to database file > if using sqlite3. > # The following settings are not used with sqlite3: > 'USER': 'django', > 'PASSWORD': 'password', > 'HOST': '', # Empty for localhost through > domain sockets or '127.0.0.1' for localhost through TCP. > 'PORT': '', # Set to empty string for default. > } > } > > ALLOWED_HOSTS = [] > > TIME_ZONE = 'Europe/Madrid' > > > LANGUAGE_CODE = 'en-us' > > SITE_ID = 1 > > USE_I18N = True > > > USE_L10N = True > > USE_TZ = True > > MEDIA_ROOT = '' > > MEDIA_URL = '' > > STATIC_ROOT = '' > > STATIC_URL = '/static/' > > STATICFILES_DIRS = () > > > STATICFILES_FINDERS = ( > 'django.contrib.staticfiles.finders.FileSystemFinder', > 'django.contrib.staticfiles.finders.AppDirectoriesFinder', > #'django.contrib.staticfiles.finders.DefaultStorageFinder', > ) > > > SECRET_KEY = 'x' > # List of callables that know how to import templates from various sources. > TEMPLATE_LOADERS = ( > 'django.template.loaders.filesystem.Loader', > 'django.template.loaders.app_directories.Loader', > # 'django.template.loaders.eggs.Loader', > ) > > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > # Uncomment the next line for simple clickjacking protection: > # 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ) > > ROOT_URLCONF = 'mysite.urls' > > # Python dotted path to the WSGI application used by Django's runserver. > WSGI_APPLICATION = 'mysite.wsgi.application' > > TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] > > > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.messages', > 'django.contrib.staticfiles', > # Uncomment the next line to enable the admin: > 'django.contrib.admin', > # Uncomment the next line to enable admin documentation: > #'django.contrib.admindocs', > 'polls' > ) > > > LOGGING = { > 'version': 1, > 'disable_existing_loggers': False, > 'filters': { > 'require_
Re: How to use dumpdata?
I found out dumpdata was not working correctly because of an app installed: django-compaign. I commented it out. On Thursday, August 8, 2013 9:27:49 AM UTC-4, frocco wrote: > > Hello, > > I am trying to use > python manage.py dumpdata > myfile.json > > It is only working if I specify each app. > > python dumpdata myapp > myfile.json > > Is there any wany to dump all apps into one file? > > Thanks > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
How to use dumpdata?
Hello, I am trying to use python manage.py dumpdata > myfile.json It is only working if I specify each app. python dumpdata myapp > myfile.json Is there any wany to dump all apps into one file? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Exception Value: No module named url -- on django poll tutorial
Sorry - I didn't look past your settings ROOT_URLCONF Nor did I see that others have responded. Please disregard mine. Cheers Mike On 8/08/2013 11:20pm, Mike Dewhirst wrote: On 8/08/2013 5:53pm, goreano wrote: Hi, I'm a newbie diving into django I've found a problem I've been hitting my head against for the last 2 days. I think it is a path issue, actually I get the same error as i try to open any URL on localhost:8000 Can you please give me a hint... I have to improve my path definition skills but I'm stuck here: I get an error: / / /ImportError at // // /No module named url/ This is the clue ... see below in your settings the ROOT_URLCONF value which is where Django looks to see if the url sent by the browser can be recognised (via matching to a Python regular expression) and if so, which view code to execute. So, that ROOT_URLCONF might include other named url modules (other whatever.py files with (url matching to view) urls you want to satisfy. By convention ROOT_URLCONF points to urls.py in the same directory as the settings.py file but it doesn't have to. If you are new to Django it can be somewhat confusing understanding the paths involved. I found it valuable to print out all the paths if DEBUG == True. Seeing them all permanently displayed by the dev server just kept reminding me where they were and made debugging static file locations and template dirs etc so easy. Hth // /Request Method:/ /GET/ /Request URL:/ /http://localhost:8000// /Django Version:/ /1.5/ /Exception Type:/ /ImportError/ /Exception Value:/ /No module named url/ /Exception Location:/ //usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in import_module, line 35/ /Python Executable:/ //usr/bin/python2.7/ /Python Version:/ /2.7.3/ /Python Path:/ /['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', '/usr/lib/python2.7/dist-packages/django']/ /Server time:/ /Thu, 8 Aug 2013 09:34:16 +0200/ this is my settings file /import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'polls', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'django', 'PASSWORD': 'password', 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '', # Set to empty string for default. } } ALLOWED_HOSTS = [] TIME_ZONE = 'Europe/Madrid' LANGUAGE_CODE = 'en-us' SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = True MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = () STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', #'django.contrib.staticfiles.finders.DefaultStorageFinder', ) SECRET_KEY = 'x' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'mysite.urls' # Python dotted pat
Re: Exception Value: No module named url -- on django poll tutorial
On 8/08/2013 5:53pm, goreano wrote: Hi, I'm a newbie diving into django I've found a problem I've been hitting my head against for the last 2 days. I think it is a path issue, actually I get the same error as i try to open any URL on localhost:8000 Can you please give me a hint... I have to improve my path definition skills but I'm stuck here: I get an error: / / /ImportError at // // /No module named url/ This is the clue ... see below in your settings the ROOT_URLCONF value which is where Django looks to see if the url sent by the browser can be recognised (via matching to a Python regular expression) and if so, which view code to execute. So, that ROOT_URLCONF might include other named url modules (other whatever.py files with (url matching to view) urls you want to satisfy. By convention ROOT_URLCONF points to urls.py in the same directory as the settings.py file but it doesn't have to. If you are new to Django it can be somewhat confusing understanding the paths involved. I found it valuable to print out all the paths if DEBUG == True. Seeing them all permanently displayed by the dev server just kept reminding me where they were and made debugging static file locations and template dirs etc so easy. Hth // /Request Method:/ /GET/ /Request URL:/ /http://localhost:8000// /Django Version:/ /1.5/ /Exception Type:/ /ImportError/ /Exception Value:/ /No module named url/ /Exception Location:/ //usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in import_module, line 35/ /Python Executable:///usr/bin/python2.7/ /Python Version:/ /2.7.3/ /Python Path:/ /['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', '/usr/lib/python2.7/dist-packages/django']/ /Server time:/ /Thu, 8 Aug 2013 09:34:16 +0200/ this is my settings file /import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'polls', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'django', 'PASSWORD': 'password', 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '', # Set to empty string for default. } } ALLOWED_HOSTS = [] TIME_ZONE = 'Europe/Madrid' LANGUAGE_CODE = 'en-us' SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = True MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = () STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', #'django.contrib.staticfiles.finders.DefaultStorageFinder', ) SECRET_KEY = 'x' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'mysite.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'mysite.wsgi.application' TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
Re: Exception Value: No module named url -- on django poll tutorial
you have a typo in the urls.py -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: problem with deploying django using mod wsgi
I have this error in the error_log file : [error] [client 10.10.8.41] File does not exist: /var/www/html/search, referer: http://tarinformatics03/mice/search_mice/ search is one of my view function why is it looking for it in the html directory ?? On Wednesday, August 7, 2013 5:25:01 PM UTC-4, sah wrote: > > Hello , I am trying to deploy django using apache and mod_wsgi but not > able to , can anyone help me on this : > > httpd.conf > -- > LoadModule wsgi_module modules/mod_wsgi.so > > WSGIScriptAlias /mice /home/getMice/webproject/wsgi.wsgi > > > > Order deny,allow > Allow from all > AddHandler wsgi-script .wsgi > SetHandler wsgi-script > > > > -- > > My views file has two functions > > One is a search_form and other is a search results ,vi > > I am able to get the search_form page but when i give input i dont get the > results page. > > urls.py > -- > > from django.conf.urls.defaults import * > from django.conf import settings > > from webapp import views > > > > urlpatterns = patterns('',url(r'^search_mice/$', views.search_mice) > ,url(r'^search/$', views.search),) > > > > > Please help me with this . > > Thanks > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Exception Value: No module named url -- on django poll tutorial
Isn't there a stacktrace that goes with that error message? On Thu, Aug 8, 2013 at 3:53 AM, goreano wrote: > Hi, > > I'm a newbie diving into django I've found a problem I've been hitting my > head against for the last 2 days. > > I think it is a path issue, actually I get the same error as i try to open > any URL on localhost:8000 > > Can you please give me a hint... I have to improve my path definition > skills but I'm stuck here: > > I get an error: > * > **ImportError at /** * > > *No module named url* > > * * *Request Method:* *GET* *Request URL:* *http://localhost:8000/* *Django > Version:* *1.5* *Exception Type:* *ImportError* *Exception Value:* > > *No module named url* > > *Exception Location:* > */usr/local/lib/python2.7/dist-packages/django/utils/importlib.py > in import_module, line 35* *Python Executable:* */usr/bin/python2.7* *Python > Version:* *2.7.3* *Python Path:* > > *['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', > > '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', > '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', > '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', > '/usr/lib/python2.7/dist-packages/gtk-2.0', > '/usr/lib/pymodules/python2.7', > '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', > '/usr/lib/python2.7/dist-packages/ubuntuone-client', > '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', > '/usr/lib/python2.7/dist-packages/ubuntuone-couch', > '/usr/lib/python2.7/dist-packages/ubuntuone-installer', > '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', > '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', > '/usr/lib/python2.7/dist-packages/django']* > > *Server time:* *Thu, 8 Aug 2013 09:34:16 +0200* > > this is my settings file > > *import os > > BASE_DIR = os.path.dirname(os.path.abspath(__file__)) > > DEBUG = True > TEMPLATE_DEBUG = DEBUG > > ADMINS = ( ) > > MANAGERS = ADMINS > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', > 'mysql', 'sqlite3' or 'oracle'. > 'NAME': 'polls', # Or path to database file > if using sqlite3. > # The following settings are not used with sqlite3: > 'USER': 'django', > 'PASSWORD': 'password', > 'HOST': '', # Empty for localhost through > domain sockets or '127.0.0.1' for localhost through TCP. > 'PORT': '', # Set to empty string for default. > } > } > > ALLOWED_HOSTS = [] > > TIME_ZONE = 'Europe/Madrid' > > > LANGUAGE_CODE = 'en-us' > > SITE_ID = 1 > > USE_I18N = True > > > USE_L10N = True > > USE_TZ = True > > MEDIA_ROOT = '' > > MEDIA_URL = '' > > STATIC_ROOT = '' > > STATIC_URL = '/static/' > > STATICFILES_DIRS = () > > > STATICFILES_FINDERS = ( > 'django.contrib.staticfiles.finders.FileSystemFinder', > 'django.contrib.staticfiles.finders.AppDirectoriesFinder', > #'django.contrib.staticfiles.finders.DefaultStorageFinder', > ) > > > SECRET_KEY = 'x' > # List of callables that know how to import templates from various sources. > TEMPLATE_LOADERS = ( > 'django.template.loaders.filesystem.Loader', > 'django.template.loaders.app_directories.Loader', > # 'django.template.loaders.eggs.Loader', > ) > > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > # Uncomment the next line for simple clickjacking protection: > # 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ) > > ROOT_URLCONF = 'mysite.urls' > > # Python dotted path to the WSGI application used by Django's runserver. > WSGI_APPLICATION = 'mysite.wsgi.application' > > TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] > > > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.messages', > 'django.contrib.staticfiles', > # Uncomment the next line to enable the admin: > 'django.contrib.admin', > # Uncomment the next line to enable admin documentation: > #'django.contrib.admindocs', > 'polls' > ) > > > LOGGING = { > 'version': 1, > 'disable_existing_loggers': False, > 'filters': { > 'require_debug_false': { > '()': 'django.utils.log.RequireDeb
Exception Value: No module named url -- on django poll tutorial
Hi, I'm a newbie diving into django I've found a problem I've been hitting my head against for the last 2 days. I think it is a path issue, actually I get the same error as i try to open any URL on localhost:8000 Can you please give me a hint... I have to improve my path definition skills but I'm stuck here: I get an error: * **ImportError at /** * *No module named url* * * *Request Method:* *GET* *Request URL:* *http://localhost:8000/* *Django Version:* *1.5* *Exception Type:* *ImportError* *Exception Value:* *No module named url* *Exception Location:* */usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in import_module, line 35* *Python Executable:* */usr/bin/python2.7* *Python Version:* *2.7.3* *Python Path:* *['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.2012100913/pysrc', '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite', '/usr/local/lib/python2.7/dist-packages/ply-3.4-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/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', '/usr/lib/python2.7/dist-packages/django']* *Server time:* *Thu, 8 Aug 2013 09:34:16 +0200* this is my settings file *import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'polls', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'django', 'PASSWORD': 'password', 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '', # Set to empty string for default. } } ALLOWED_HOSTS = [] TIME_ZONE = 'Europe/Madrid' LANGUAGE_CODE = 'en-us' SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = True MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = () STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', #'django.contrib.staticfiles.finders.DefaultStorageFinder', ) SECRET_KEY = 'x' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'mysite.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'mysite.wsgi.application' TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: #'django.contrib.admindocs', 'polls' ) LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, },