Re: django-facebook
I'm using Django Socialregistration for this purpose. http://github.com/flashingpumpkin/django-socialregistration If the user is already logged in and clicks the facebook button, the existing account is simply linked to the FB account. New users have the option to set up a username. - Sævar On Oct 8, 5:19 pm, shacker wrote: > I chose django-facebook to allow site authentication via Facebook > Connect because it seems to be alone amongst the various solutions in > knowing how to smartly connect existing site accounts to FB logins > rather than blindly creating new accounts (if you have users who > sometimes log in the traditional way and other times via FB, they end > up with two accounts in the system). > > All went well with implementation until I hit this issue, and it's a > show-stopper: > > http://github.com/ryanmark/django-facebookconnect/issues/#issue/3 > > No response from the developer there, so asking here - has anyone hit > this? How did you overcome? Is there another Facebook Connect app you > prefer? Or a more recent fork of django-facebook that works better? > > Thanks, > Scot -- 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: "strange" permission requirements
Thanks, will look at this! -- 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: trying to get a cache per request
Thanks again Doug, I understand your method. I think the problem is that it might be too much overhead for what I can gain using a cache, so I might drop the idea of adding one. In any case, your explanation will be probably worth in future projects :) Regards, Miguel 2010/10/10 Doug > Look around for python docs on threading.local, which lets you set a > 'global' variable for just that thread. Since a request is only going > to happen in a single thread, that lets you have a per-request global > that can be used for cache storage. With middleware to set the > threading local instance up, and remove it at the end of the request. > I think it will do what you want. One bit of weirdness I noticed was > that you always need to import the global in exactly the same way > everywhere you want it, otherwise you may not be referring to the same > variable. > > -- > 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. > > -- 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: get_absolute_url error with sitemaps
Ok I use a slug field to retrieve an url from the database and apperently get_absolute_url() doesn't work with slugs. I added a location to my sitemap.py which gives the following result; - http://www.example.com/{'slug': u'assortiment'} Here is my sitemap.py: from django.contrib.sitemaps import Sitemap from jouwsta.verkoop.models import * class PaginaSitemap(Sitemap): def items(self): return Pagina.objects.values('slug') def location(self, obj): return obj Seems that i am almost there :-) Who can give me a hint for the last step to get a correct url? -- 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.
cannot open Django official website
Anybody know what's wrong with django official website www.djangoproject.com? I can't open it by several days. Is it down or just my access request was blocked? -- 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.
TypeError / get_response: Can't figure it out?
Hey, I'm a newbie to Django/Python world (PHP guy). I'm just going through some tutorials to get things figured out. Everything was working fine until when I was working through the last section of http://djangobook.com/en/2.0/chapter03/ on Dynamic URLs. It seems be an error in the views.py. When I enter the follow: def hours_ahead(request, offset): # try: # offset = int(offset) # except ValueError: # raise Http404() dt = datetime.datetime.now() + datetime.timedelta(hours=offset) html = "In %s hour(s), it will be %s." % (offset, dt) return HttpResponse(html) I got to this error: TypeErrorhours_ahead() takes exactly 2 arguments (1 given) It mentions: Exception Location: /usr/lib/pymodules/python2.6/django/ core/handlers/base.py in get_response, line 92 It would seem to be some error with the get_response. Have I set something up wrong that it isn't pulling the information back correctly? I'm rather stumped. I'd really appreciate a bit of help on this one. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: cannot open Django official website
Form me is working right now. I don't know if it wasn't available before. Roberto On Sun, Oct 10, 2010 at 12:53 PM, retzzz wrote: > Anybody know what's wrong with django official website > www.djangoproject.com? > I can't open it by several days. Is it down or just my access request > was blocked? > > -- > 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. > > -- 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: TypeError / get_response: Can't figure it out?
On Sun, Oct 10, 2010 at 8:44 AM, Sleek wrote: > I'm a newbie to Django/Python world (PHP guy). I'm just going through > some tutorials to get things figured out. Everything was working fine > until when I was working through the last section of > http://djangobook.com/en/2.0/chapter03/ on Dynamic URLs. It seems be > an error in the views.py. When I enter the follow: > def hours_ahead(request, offset): > # try: > # offset = int(offset) > # except ValueError: > # raise Http404() > dt = datetime.datetime.now() + datetime.timedelta(hours=offset) > html = "In %s hour(s), it will be %s." % > (offset, dt) > return HttpResponse(html) > > I got to this error: TypeErrorhours_ahead() takes exactly 2 > arguments (1 given) > It mentions: Exception Location: /usr/lib/pymodules/python2.6/django/ > core/handlers/base.py in get_response, line 92 > > It would seem to be some error with the get_response. Have I set > something up wrong that it isn't pulling the information back > correctly? > It sounds like you have not followed the instructions to put parentheses around the data in the url pattern that you want to have passed into the view (the paragraph that starts "Now that we’ve designated a wildcard for the URL, we need a way of passing that wildcard data to the view function, so that we can use a single view function for any arbitrary hour offset." Karen -- http://tracey.org/kmt/ -- 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: cannot open Django official website
On Sun, Oct 10, 2010 at 5:53 PM, retzzz wrote: > Anybody know what's wrong with django official website www.djangoproject.com? > I can't open it by several days. Is it down or just my access request > was blocked? By any chance, have you installed (or just recently uninstalled) the Weave extension in Firefox? We've had a number of reports that this extension can put a non-RFC2616 compliant Accept-Language header in requests, which causes some problems with Django's website. Even if you haven't installed Weave, if your Accept-Language header looks something like "pt-br,chrome://global/locale/intl.properties;q=0.5" (i.e., contains a URL that clearly isn't a language code), then that is probably the issue. Yours, Russ Magee %-) -- 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.
django, celery and mysql: Lost connection to MySQL server during query
Using django 1.2.3 with celery 2.0.3 and django-celery 2.0.3 and mysql 5.1.41 on kubuntu 10.04, I receive the following error: OperationalError(2013, 'Lost connection to MySQL server during query'). The error occurs every time the task is executed and seems to be related to the execution time, in fact when I process smaller files (let's say 8000 lines) everything is fine and task ends with success. The current files count about 242000 lines and execution started at 13:17:01 and failed at 16:08:47. I noticed using htop that cpu load is about 100% on both cores; (Intel(R) Xeon(R) CPU 3040 @ 1.86GHz). Could this cause the mysql error 2013? The python code is quite long, and I am not copying it here because the error is mysql related... Does anybody have any ideas? [2010-10-09 15:50:15,265: ERROR/MainProcess] Task igs.tasks.advanced_statistics[e886e849-cfcc-42b9-a171-0a2d56778f6b] raised exception: OperationalError(2013, 'Lost connection to MySQL server during query') Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/worker/job.py", line 86, in execute_safe return self.execute(*args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/worker/job.py", line 101, in execute return super(WorkerTaskTrace, self).execute() File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/execute/trace.py", line 62, in execute retval = self._trace() File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/execute/trace.py", line 76, in _trace return handler(trace.retval, trace.exc_type, trace.tb, trace.strtb) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/worker/job.py", line 122, in handle_failure exc = self.task.backend.mark_as_failure(self.task_id, exc, strtb) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/backends/base.py", line 46, in mark_as_failure traceback=traceback) File "/usr/local/lib/python2.6/dist-packages/celery-2.0.3-py2.6.egg/celery/backends/base.py", line 152, in store_result return self._store_result(task_id, result, status, traceback) File "/usr/local/lib/python2.6/dist-packages/django_celery-2.0.3-py2.6.egg/djcelery/backends/database.py", line 12, in _store_result traceback=traceback) File "/usr/local/lib/python2.6/dist-packages/django_celery-2.0.3-py2.6.egg/djcelery/managers.py", line 42, in _inner transaction.rollback_unless_managed() File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/transaction.py", line 188, in rollback_unless_managed connection._rollback() File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/backends/mysql/base.py", line 306, in _rollback BaseDatabaseWrapper._rollback(self) File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/backends/__init__.py", line 36, in _rollback return self.connection.rollback() OperationalError: (2013, 'Lost connection to MySQL server during query') skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com Mi scriva in italiano; Write me in English; Skribu al mi Esperante! -- 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: Admin Many-to-Many on a regular Form?
On Fri, Oct 8, 2010 at 7:58 PM, AK wrote: > I really like the 'filter-horizontal' style widget used by Django > Admin for things like specifying permissions for users/groups. I > would like to create a form that uses this same widget to allow > someone to select a group and then edit which users are in the group > based on this widget. The catch for me is I need to do it through the > standard part of my site, not the admin interface. > +1 I'm also interested on this! > -- > Marc -- 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, celery and mysql: Lost connection to MySQL server during query
Den 10/10/2010 kl. 16.34 skrev Massimiliano della Rovere: > Using django 1.2.3 with celery 2.0.3 and django-celery 2.0.3 and mysql > 5.1.41 on kubuntu 10.04, I receive the following error: > OperationalError(2013, 'Lost connection to MySQL server during query'). > > The error occurs every time the task is executed and seems to be > related to the execution time, in fact when I process smaller files > (let's say 8000 lines) everything is fine and task ends with success. > The current files count about 242000 lines and execution started at > 13:17:01 and failed at 16:08:47. > I noticed using htop that cpu load is about 100% on both cores; > (Intel(R) Xeon(R) CPU 3040 @ 1.86GHz). Could this cause the mysql > error 2013? > > The python code is quite long, and I am not copying it here because > the error is mysql related.. * Are you keeping a connection open to MySQL the whole time? * What are the values of your timeout settings in the MySQL server configuration? * Anything in the MySQL server error log? * Anything in the MySQL slow query log, if you have that set up? * Which process(es) on the server is using 100% CPU time? I suspect that you're opening a connection to the server, doing something in Django for a long time, and then trying to use the connection. At this point MySQL has lost patience and closed the connection. Thanks, Erik smime.p7s Description: S/MIME cryptographic signature
Django logging database changes
Hello I have a very simple app that I am writing that simply stores form data to a database. I can then scroll through and edit data stored in the database. I was wondering if there is a built in function that would enable me to log all data update/changes like the django admin history log does. I didn't want to start work on it, and then find something already existed. Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: cannot open Django official website
Hi Russell. You are right, it must be because the extension of Firefox though I didn't install Weae extension. I can access django site through Firefox 4.0 beta 8 pre. Most plugin can't work in this version of Firefox. Then when I uninstalled some of my extensions under Firefox 3.8, I can open the site. But it's weird that the problem didn't happen again when I reinstall all my extensions that I just uninstalled. So I didn't find which one result in the problem. Anyway, than you very much. On Oct 10, 9:41 pm, Russell Keith-Magee wrote: > On Sun, Oct 10, 2010 at 5:53 PM, retzzz wrote: > > Anybody know what's wrong with django official websitewww.djangoproject.com? > > I can't open it by several days. Is it down or just my access request > > was blocked? > > By any chance, have you installed (or just recently uninstalled) the > Weave extension in Firefox? We've had a number of reports that this > extension can put a non-RFC2616 compliant Accept-Language header in > requests, which causes some problems with Django's website. > > Even if you haven't installed Weave, if your Accept-Language header > looks something like > "pt-br,chrome://global/locale/intl.properties;q=0.5" (i.e., contains a > URL that clearly isn't a language code), then that is probably the > issue. > > Yours, > Russ Magee %-) -- 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, celery and mysql: Lost connection to MySQL server during query
On Sun, Oct 10, 2010 at 17:12, Erik Cederstrand wrote: > > * Are you keeping a connection open to MySQL the whole time? I do not know what is the default behaviour of django, but I did not specify any custom option. > * What are the values of your timeout settings in the MySQL server configuration? Here is the my.cnf without comments for brevity's sake: [client] port= 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice= 0 [mysqld] user= mysql socket = /var/run/mysqld/mysqld.sock port= 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp skip-external-locking key_buffer = 16M max_allowed_packet = 16M thread_stack= 192K thread_cache_size = 8 myisam-recover = BACKUP query_cache_limit = 1M query_cache_size= 16M general_log_file= /var/log/mysql/mysql.log general_log = 1 log_error= /var/log/mysql/error.log log_slow_queries= /var/log/mysql/mysql-slow.log long_query_time = 2 log-queries-not-using-indexes expire_logs_days= 10 max_binlog_size = 100M binlog_do_db= include_database_name binlog_ignore_db= include_database_name [mysqldump] quick quote-names max_allowed_packet = 16M [isamchk] key_buffer = 16M !includedir /etc/mysql/conf.d/ > * Anything in the MySQL server error log? nothing unusual in the error log, just the log coming from the two /etc/init.d/mysql.d restart I issued today. > * Anything in the MySQL slow query log, if you have that set up? Yes I set it up. Lots of query issued by my program are in the query log, with no errors reported. the last one is at 16:08:34 and the error was returned at 16:08:47. > * Which process(es) on the server is using 100% CPU time? directly from htop: PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 544 mader 20 0 969M 953M 1444 R 96.0 47.4 50:09.85 python ./manage.py celeryd -l warning > I suspect that you're opening a connection to the server, > doing something in Django for a long time, and then > trying to use the connection. At this point MySQL has > lost patience and closed the connection. The db is queried by my code often: the maximum time between two successive queries is no more than 10 seconds, the source of this info is mysql-slow.log. Again, I do not know how django handles connections... The python function / task raising this error is part of a billing program. The task elaborates a csv file with the calls made by the customers: each call "searches" the db for info about the calling number owner and the cost of the called number and other things. Through empirical tests, I noticed that the error raises after about 165000 lines(=calls) are elaborated (the file usually contains about 245000), but everything is fine with fewer. One solution could be splitting the file in pieces and then unifying the results but it's not understanding and solving the problem, but just circumventing it... -- 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: How to specify NULL as the default of a model field.
Are you adding the field to the model or is the field is already there and you're just adding null=True to it's definition. In the second case, the *backwards* migration will require a default value for instances that have NULL value. On 10 October 2010 00:49, Tim Diggins wrote: > Yes I'm setting blank=True and null=True. But, when I migrate using > South (I've added this field to an existing model), South complains > that the field has no default value... In this instance, it isn't that > important, but just wondering how I specify "NULL" in python in future > (I would normally guess None, but that won't help in this instance).. > Although it's not important I wondered how I can indicate to South > that the default value IS actually NULL - but maybe this is a South > question not a Django (core) question. > > -- > 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. > > -- Łukasz Rekucki -- 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: get_absolute_url error with sitemaps
It was as easy as: def location(self, obj): return obj['slug'] Finally :-) :-) ...is this the right way to make a good sitemap.xml file? -- 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-facebook
On Oct 10, 1:34 am, Sævar Öfjörð wrote: > I'm using Django Socialregistration for this > purpose.http://github.com/flashingpumpkin/django-socialregistration > > If the user is already logged in and clicks the facebook button, the > existing account is simply linked to the FB account. > New users have the option to set up a username. Ah - good to know django-facebookconnect isn't the only app doing that correctly, thanks for that. I did eventually get things worked out with django-facebookconnect - you can get into some weird situations with multiple cookies/sessions, multiple logins, multiple linkages, trying to log into one account when a previous cookie hasn't been deleted, etc. ... the kind of stuff you're likely to hit during development but that users aren't. I think I've got it solid now, but will consider switching to django-socialauth if I hit further problems, thanks. ./s -- 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, celery and mysql: Lost connection to MySQL server during query
Den 10/10/2010 kl. 17.55 skrev Massimiliano della Rovere: > > * Which process(es) on the server is using 100% CPU time? > directly from htop: > PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command > 544 mader 20 0 969M 953M 1444 R 96.0 47.4 50:09.85 python > ./manage.py celeryd -l warning This, and the fact that you have no errors or seriously long queries in your slow query log, indicates that the MySQL server is operating fine. Something seems to be timing out on the MySQL side. I'm not sure if you mentioned it, but are these InnoDB tables? The stack trace you posted is in the rollback of a transaction. It's possible that everything is running within the same transaction which MySQL is shutting down at some point. Try this: SQL> show variables where variable_name LIKE '%timeout%'; to see the values in your current server instance. If nothing suspicious turns up, I guess it's time to follow the stack trace into the celery source code or where your own code calls celery and add some debugging. Maybe it's a specific query that trips the code. Maybe it's a specific number of queries. Maybe it's at a specific timespan after connecting to MySQL. Thanks, Erik smime.p7s Description: S/MIME cryptographic signature
Re: Django.contrib.gis.gdal Questions
I also don't see setter properties (only getters) in feature.py or field.py. So I'm pretty sure it's only a read only implementation. I guess if I wanted I could write my own wrappers for this write functionality using Python ctypes, but I'm currently not smart enough. The reason I care about this is b/c OGR official bindings are currently giving me trouble and I was wondering if django.contrib.gis.gdal could be used as a workaround. So I'm wondering what the use of these bindings are in the larger django project? Are they used at different points in django behind the scenes to do interop to other data formats? Or is the point of these wrappers more as a utility for users to inspect data (mainly shapefiles)? Just wondering :) On Oct 9, 7:50 am, Greg Corradini wrote: > I'm wondering if django.contrib.gis.gdal Python wrappers were only > meant to implement read functionality of OGR? It seems that way. I > don't see any implementation of CreateDatasource in the driver.py > class. Is this correct or is there a way to write to shapefiles with > these bindings that I'm missing? Just wondering :) -- 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.
trouble creating first project
Hi, I am having trouble creating my first project. I am running the latest version of Ubuntu and I installed Django from svn, when I run 'import django' i get no errors back so I assume its installed OK. When I run 'django-admin.py startproject myproject' I get back an error saying 'django-admin.py: command not found'. How can I solve/get around this error? Appreciate any help/ advice offered -- 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: trouble creating first project
It seems that the command you're running is not on your PYTHONPATH. You may have to enter the full path to django-admin. Shawn -- 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: trouble creating first project
Hi Phil, On Mon, Oct 11, 2010 at 8:47 AM, Phil wrote: > When I run 'django-admin.py startproject myproject' I get back an > error saying 'django-admin.py: command not found'. > Run the following from a shell prompt: ls -l `which django-admin.py` and let us know the result. Yours, Jonathan -- 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.
how to avoid error opening a url
hi In my application I am taking user given url strings.The user is likely to enter 'www.google.com' instead of 'http:// www.google.com' .When I try to open the url import urllib2 page=urllib2.urlopen(url) can give a ValueError if the user fails to enter 'http'.How can this problem be addressed?do I have to prepend 'http' to every urlstring before trying to open it using urlopen? thanks jim -- 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: how to avoid error opening a url
On 11 ?.?. 2010, at 11:00, jimgardener wrote: > hi > In my application I am taking user given url strings.The user is > likely to enter 'www.google.com' instead of 'http:// > www.google.com' .When I try to open the url > > import urllib2 > page=urllib2.urlopen(url) > > can give a ValueError if the user fails to enter 'http'.How can this > problem be addressed? I think the most 'correct' way to do this would be to use a URLField in your form so that form.is_valid() will force the user to enter the http:// themselves. (Of course a message to the user on the form explaining this would be helpful.) This will also have nice side-effects like checking that it ends in a valid TLD, and if you set URLField.verify_exists=True it will even ensure that the URL leads somewhere other than a 404. > do I have to prepend 'http' to every urlstring > before trying to open it using urlopen? Otherwise yes, I'd use something like: if not url.startswith('http://'): url = 'http://' + url I'm a Django newbie myself, however, so someone else may chime in with a better option for you. Good luck! Jonathan > thanks > jim > > -- > 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. > -- 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.