Re: Django URL pattern - template tags

2011-09-02 Thread Piotr S
All correct :) On Sat, Sep 3, 2011 at 3:28 AM, Tomas Neme wrote: > I'll still answer this just in case. You should have the following in > your urls.py: > > urlpatterns += (.., > url(r'(P)\w+/(P)\d+/(P)\[w-]+/', your_view, > name='yoururlname'), ) > > and then you

Re: Can I write tests for 3rd party url shortener?

2011-09-02 Thread Andy McKay
On 2011-09-02, at 4:58 AM, Yaşar Arabacı wrote: > > Is there a way to test whether or not a 3rd party url shortener works. What I > have in mind is this: Sure, python has libraries like urllib for dong that sort of thing. http://docs.python.org/library/urllib.html -- Andy McKay

Re: Too many TCP connections

2011-09-02 Thread Tomas Neme
shot in the dark: aren't they connections to the database, maybe? On Sat, Sep 3, 2011 at 12:56 AM, shacker wrote: > Hmm, appreciate the feedback, but we don't have KeepAlives enabled on our > Django servers and it's never been a problem. And remember, the other Django >

Re: configuration field

2011-09-02 Thread Andy McKay
On 2011-09-02, at 5:22 PM, Mo Mughrabi wrote: > The problem with my approach that the xml is not validated and the reading > operation can be exhausting to parse the xml every time. Why are you parsing through the XML every time? That seems awfully inefficient. There are xml parsers that don't

Re: Django URL pattern - template tags

2011-09-02 Thread Tomas Neme
I'll still answer this just in case. You should have the following in your urls.py: urlpatterns += (.., url(r'(P)\w+/(P)\d+/(P)\[w-]+/', your_view, name='yoururlname'), ) and then you can have in your template {{ n.title }} I hope I didn't make any mistakes. tomas -- "The whole of

Re: Problem with file upload!

2011-09-02 Thread Mo Mughrabi
is there any error messages you seeing? or logged? does the file exists on the filesystem? On Fri, Sep 2, 2011 at 8:39 PM, Ludvig wrote: > Hello, > > Usually only read these posts so i hope i'm doing this right! > > Recently my file upload just stopped working, and i've

Re: Multiple Database Routing Based on Site

2011-09-02 Thread Mo Mughrabi
What I did is create an attribute in my models and called it model.py class Data(models.Model): # connection_name is my database name which points to the name from settings.py connection_name = "gis" name = models.CharField(max_length=50) area = models.IntegerField() and created

configuration field

2011-09-02 Thread Mo Mughrabi
Hi I have a table which every has TextField to store plain text. Am using this field for configuration and putting there some XML to read later on. The problem with my approach that the xml is not validated and the reading operation can be exhausting to parse the xml every time. And since

Re: Too many TCP connections

2011-09-02 Thread shacker
Hmm, appreciate the feedback, but we don't have KeepAlives enabled on our Django servers and it's never been a problem. And remember, the other Django site on the same server doesn't have the problem. As for serving lots of resources - we're just talking about viewing/saving seven User pages in

Re: Too many TCP connections

2011-09-02 Thread Cal Leeming [Simplicity Media Ltd]
Only briefly read this email, but it could be due to keep alives not being enabled, along with lots of resources (images, css, js) etc being called. Let me know if this helps Cal On Fri, Sep 2, 2011 at 8:16 PM, shacker wrote: > This is not a database connection question,

Odp: Django URL pattern - template tags

2011-09-02 Thread Petey
Problem solved. I was too tired to find my mistake earlier ;) -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/JJP1kz7lyZAJ. To post to this group, send

Too many TCP connections

2011-09-02 Thread shacker
This is not a database connection question, but a TCP connection problem. I've got two different Django sites on the same server (which I admin), each with their own similar vhosts and wsgi processes. The server uses ConfigServer firewall for automatic detection and firewalling of bad

Re: problem with syncdb and MyQSL

2011-09-02 Thread John Boudreau
This is what I finally got: C:\Python27>python c:\python27\mysite2\manage.py syncdb Creating tables ... Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Traceback (most recent call last): File "c:\python27\mysite2\manage.py", line 14, in

Problem with file upload!

2011-09-02 Thread Ludvig
Hello, Usually only read these posts so i hope i'm doing this right! Recently my file upload just stopped working, and i've no idea what i've changed. I noticed that request.FILES is empty so i've googled some and cant figured out my problem. My form looks like this

Re: problem with syncdb and MyQSL

2011-09-02 Thread John Boudreau
Ok. I created a new database entirely and un-commented the APPS. I then ran the following command: C:\Python27>python c:\python27\mysite2\manage.py syncdb I hit enter about 5 mins ago and it's still at: Creating tables Creating table auth_permission Creating table auth_group_permissions

Django URL pattern - template tags

2011-09-02 Thread Petey
Hey I've made a view which should generate url in form like this (example.com/type/id/slug : example.com/news/1/lorem-ipsum/) To generate links I use: {{ n.title|safe}} It isn't the correct form for that as far as I know. Could someone explain me how to use {% url %} tag in this situation? I

Re: problem with syncdb and MyQSL

2011-09-02 Thread yoursurrogategod
The only thing that pops in my mind right about now is to delete the currently created table and then proceed to re-run syncdb (leave the other apps uncommented.) On Sep 2, 2011, at 1:01 PM, John Boudreau wrote: > Great. Yes, when I first experienced the issue (prior

Re: problem with syncdb and MyQSL

2011-09-02 Thread John Boudreau
Great. Yes, when I first experienced the issue (prior to creating the polls app, with those APPS un-commented), I logged into the database and found the following tables had been created: TableRowsTypeSizeCommentsauth_group_permissions0Xeround0 Bauth_permission0 Xeround0 B2 tables0--0 B So it

Re: problem with syncdb and MyQSL

2011-09-02 Thread Yves S. Garret
I'm curious, maybe someone knows this who has actually seen the code behind the scenes, but is this actually true? When Django says "Creating tables ... Creating table polls_poll", does that mean it's already connected to the database and working on it or is it a message that's produced

Re: problem with syncdb and MyQSL

2011-09-02 Thread John Boudreau
I had the same problem with those un-commented, so I create an app polls (per the tutorial) and commented those out to see if it made a difference and it didn't. In the tutorial is says, "For the minimalists Like we said above, the default applications are included for the common case, but not

Re: problem with syncdb and MyQSL

2011-09-02 Thread Yves S. Garret
I'm looking at this portion: +++ INSTALLED_APPS = ( #'django.contrib.auth', #'django.contrib.contenttypes', #'django.contrib.sessions', #'django.contrib.sites', #'django.contrib.messages', #'django.contrib.staticfiles', 'polls' #

Re: problem with syncdb and MyQSL

2011-09-02 Thread John Boudreau
Yes I have. When I run the syncdb command it starts creating the tables then hangs So it is connecting to the MySql DB I created... On Fri, Sep 2, 2011 at 12:43 PM, chandrakant kumar wrote: > On 9/2/11, John wrote: > > I am a total noob so

Re: problem with syncdb and MyQSL

2011-09-02 Thread chandrakant kumar
On 9/2/11, John wrote: > I am a total noob so forgive my ignorance, but I have been going > through the Django tutorial - > https://docs.djangoproject.com/en/1.3/intro/tutorial01/ > > I am at the point in the tutorial where I run the following command: > >

Re: problem with syncdb and MyQSL

2011-09-02 Thread John
On Sep 2, 12:37 pm, "Yves S. Garret" wrote: > Show me your settings.py file, just post all of it. > Please see my settings.py file below. I "X's" out the password etc DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_em...@example.com'),

Re: problem with syncdb and MyQSL

2011-09-02 Thread Yves S. Garret
Show me your settings.py file, just post all of it. On Fri, Sep 2, 2011 at 11:38 AM, John wrote: > I am a total noob so forgive my ignorance, but I have been going > through the Django tutorial - > https://docs.djangoproject.com/en/1.3/intro/tutorial01/ > > I am at the

problem with syncdb and MyQSL

2011-09-02 Thread John
I am a total noob so forgive my ignorance, but I have been going through the Django tutorial - https://docs.djangoproject.com/en/1.3/intro/tutorial01/ I am at the point in the tutorial where I run the following command: C:\Python27>python c:\python27\mysite2\manage.py syncdb Creating tables ...

Re: Unable to have a template NOT show up

2011-09-02 Thread Yves S. Garret
You know what would be great? Seeing the finished code for this tutorial, has anyone seen it? I'm know I tripped up somewhere and that's the main reason why I'm getting these errors, so seeing the finished product would be a nice thing to look at right now. On Fri, Sep 2, 2011 at 9:36 AM, Yves

Re: Testing reusable apps

2011-09-02 Thread Jacob Kaplan-Moss
On Fri, Sep 2, 2011 at 9:16 AM, Tomek Paczkowski wrote: > Hi, I cannot find any good source on how test reusable apps. I poked around > and found out that people (django-registration, south) tests on blank > project. > This seems kind of wrong having to make some outside directory

Testing reusable apps

2011-09-02 Thread Tomek Paczkowski
Hi, I cannot find any good source on how test reusable apps. I poked around and found out that people (django-registration, south) tests on blank project. This seems kind of wrong having to make some outside directory to be able to run tests. Isn't there any better way? -- You received this

Re: Pickling a QuerySet

2011-09-02 Thread Kevin
Thank you for this Tom, it's been awhile since I read about the QuerySet API. Kayode: I'm not sure you can export such data as a CSV. Why do you need the date exported in this manner? You can export the exact data from the database into a CSV, but re-importing would need a bit of work. I have

Re: Unable to have a template NOT show up

2011-09-02 Thread Yves S. Garret
Yes, it is. + # Django settings for mysite project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_em...@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'sqlite3', # Add

Re: Pickling a QuerySet

2011-09-02 Thread Tom Evans
On Fri, Sep 2, 2011 at 11:05 AM, Kevin wrote: > An interesting question here, not sure if anybody has tried to pickle > their QuerySets before. > Not only have people tried this before, but there is an entry in the manual about it:

Re: Pickling a QuerySet

2011-09-02 Thread Kayode Odeyemi
Thanks for this. I have a question. Is it possible to pickle a QuerySet and write to csv? I have been trying to use pickle to achieve the same stuff you just did. But I guess I've not been patient enough. Thanks On Fri, Sep 2, 2011 at 11:17 AM, Kevin wrote: > Wow! This

Can I write tests for 3rd party url shortener?

2011-09-02 Thread Yaşar Arabacı
Hi, Is there a way to test whether or not a 3rd party url shortener works. What I have in mind is this: get short url from third party application send a request to that link see if that link is redirected to what it is supposed to redirected? -- http://yasar.serveblog.net/ -- You received

Explicit transactions in non-web app, avoiding "idle in transaction"

2011-09-02 Thread Willem de Jonge
Hi, We are using the Django ORM model outside the web context in a long lived process. This works quite well however the Postgres database connection is always "idle in transaction", which blocks other DB operations we need to do. To fix this we use the database-level autocommit option ()

Re: Multiple Database Routing Based on Site

2011-09-02 Thread Kevin
The only solution I can directly think of, since the SITE_ID is in settings.py would be to use some python logic to determine the database for that site. eg. if SITE_ID == 1: ... Database settings for site 1 here ... Use an if-then like this in your settings.py. Now if what your going after

Re: Pickling a QuerySet

2011-09-02 Thread Kevin
Wow! This is very interesting and I did not expect the results. The following: >>> dat = pickle.loads(open('kbase.dat','rb').read()) >>> for item in dat: ... item.save() Worked flawlessly! It recreated all the data in the database that I removed to see what would happen if I unpickled it and

Re: Template image display issue

2011-09-02 Thread SSozuer
my settings.py file was not configured how to handle static files (images/js/css..) so far i made settings for that. In deployment, or in production there is no issue anymore. Selcuk On Sep 2, 12:35 am, Reinout van Rees wrote: > On 01-09-11 23:25, SSozuer wrote: > > > Hi, >

Pickling a QuerySet

2011-09-02 Thread Kevin
An interesting question here, not sure if anybody has tried to pickle their QuerySets before. Here's an example that does work: entry_list = Entry.objects.all() response = HttpResponse(pickle.dumps(entry_list),mimetype='application/x- pickle.python')

Extending admin's index view

2011-09-02 Thread Ivan Ivanov
Hallo everybody! I've got problem exteding the admin's index view. I need to pass extra_context to the index of the admin, after the administrator logged in, that's why I'm trying to extend the view. So... What I've got is: In the root of the project I modified urls.py like following: