Re: Is there a way to insert data from a csv file into my database?

2011-07-25 Thread km
pls try "copy" in postgres.
KM

On Mon, Jul 25, 2011 at 7:46 PM, Josh  wrote:

> pgloader is for Postgres I think. If it has to be to a single table it
> shouldn't be that difficult in Python:
>
>
> 1) get sqlalchemy and declare the django-table. You can use
> SQLAutocode for this.
> 2) import and parse the csv-file ( import csv )
> 3) use the parsed csv as input for  sqlalchemy and add the data to the
> table. I think it also handles the sequences for the id-field well.
>
> On Jul 21, 6:17 am, Eiram  wrote:
> > Greetings,
> >
> > I'm a newbie in databases, and I was wondering if there is possible to
> > insert data from a csv file into one of the tables of my database. I
> > heard that you can use a tool called pgloader, but I don't know how to
> > use this tool or if it is possible to do this with django. Does anyone
> > knows a way to do this on django or pgloader? I really will appreciate
> > your help.
> >
> > Best Regards,
> >
> > Jary
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MEDIA and STATIC in a nutshell?

2011-05-13 Thread km
Hi,

On Sat, May 14, 2011 at 10:24 AM, Shawn Milochik  wrote:

> Did you read the docs?
> http://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/
>
> To use the staticfiles app you need to not only put the right things in
> settings.py, but also run manage.py collectstatic to gather up all your
> static content, then rsync/copy/whatever that content to the proper location
> on your server so that the stuff you put in settings.py is valid.
>
> Same thing for media, to some extent (no 'collectstatic' analog). Django's
> not going to serve your media or your static content in production. That's
> going to be up to your Web server (Apache/nginx/lighttpd/whatever), and
> setting that up properly is your job. It's way outside of the scope of
> Django to do this for you.
>
> If django is not going to serve media in production and we totally depend
on webserver to do that then what is the point in having variables such as
MEDIA  and STATIC ?

Probably, one can setup -static media- on the webserver which could be
accessed as www.url/media and thus refer to this relative path as /media in
templates instead of {{MEDIA}} or {{STATIC}}; which is much simpler than
meddling with STATIC or MEDIA variables. Isnt it ?

KM

>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: class based views

2011-05-12 Thread km
ah! thanks - thisis what i require.
regards,
KM

On Thu, May 12, 2011 at 1:31 PM, Michal Petrucha wrote:

> On Thu, May 12, 2011 at 12:26:13PM +0530, km wrote:
> > Hi all,
> >
> > I do not find any help page on migrating existing function based views
> > (defined in views.py of django app) to class based views in django.1.3
> > pointers and help  appreciated.
>
> There is a migration guide, you can find it for example via the 1.3
> release notes:
>
> http://docs.djangoproject.com/en/dev/topics/generic-views-migration/
>
> Michal Petrucha
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk3Lk+8ACgkQ11l9uIBrcFT1ZwCgneOWREnW5A7QaIrawgTbteIz
> F6AAn26HARNPgQ3nkGan0fmiiunAPyfD
> =49Ia
> -END PGP SIGNATURE-
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



class based views

2011-05-11 Thread km
Hi all,

I do not find any help page on migrating existing function based views
(defined in views.py of django app) to class based views in django.1.3
pointers and help  appreciated.

regards,
KM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is there any Open Source Django Newspaper CMS?

2011-03-24 Thread km
try https://www.django-cms.org/
KM

On 3/24/11, Rehmetjan Tursun  wrote:
> Thanks Shacker, this is really helped me. this is really what I want to.
> Ellington is Commercial, not for free. Armstrong CMS is good and open
> source.
> but it says it will released at June 2011. and I will wait :)
>
>
> On Thu, Mar 24, 2011 at 12:32 AM, shacker  wrote:
>
>> Django is used by a lot of newspaper / news sites, but they generally
>> use it to build the CMS that fits their exact needs. That's kind of
>> the point of using a framework like Django rather than a CMS like
>> Drupal - you don't suffer from the "opinions" of the CMS, and instead
>> use the tools provided (plus re-usable apps) to build a system that
>> fits your org perfectly.
>>
>> That said, newspapers do have a lot of needs in common, and Ellington
>> has been the big commercial Django CMS tuned to that need. But the
>> Knight Foundation, who have sponsored innovation and advancement in
>> news publication for decades, have just awarded nearly a million
>> dollars to the Bay Citizen and the Texas Tribune (two big Django news
>> shops) to develop an open source Django-based CMS tuned to news needs:
>>
>>
>> http://www.niemanlab.org/2011/03/wordpress-for-news-orgs-knight-gives-bay-citizen-texas-tribune-975000-for-open-source-cms/
>>
>> Until that's release, your best bet is to do what all news orgs using
>> Django do - use it to build the CMS you need.
>>
>> 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-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> *Rehmetjan Tursun*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: mod_wsgi or mod_fcgi

2011-02-25 Thread km
yes nginx+uwsgi seems to be the best combination for django.
KM
On Fri, Feb 25, 2011 at 5:36 AM, Eugene MechanisM <
eugene.mechan...@gmail.com> wrote:

> > I used this for several months, and encountered all kinds of horrible
> memory
> > allocation problems, crashes, etc etc.
> it's can be posiible with any server software if this server is bad
> configured.
> I'll never use apache or cherokee or lighttpd, coz nginx faster and
> better.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



handle runtime exceptions in django view functions

2011-02-06 Thread km
Hi all,
How do I log exceptions to a file from view functions at runtime ?
I am using nginx (0.8.54) + uwsgi (0.9.6.7) + django(1.2.4) setup with
python 2.7
the uwsgi doesnt seem to log any errors from the django views even when I
use --logto option for uwsgi

pls let me know
thanks,
KM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Amazing work

2011-02-02 Thread km
On Thu, Feb 3, 2011 at 8:18 AM, Kenneth Gonsalves wrote:

> On Wed, 2011-02-02 at 08:56 -0600, Jon J wrote:
> > I just stumbled upon django when looking for a good way to use Python
> > in web programming,
>
> welcome to the club - btw, how did you manage to avoid stumbling over
> django all these years?
> --
> regards
> KG
> http://lawgon.livejournal.com
> Coimbatore LUG rox
> http://ilugcbe.techstud.org
>
Hi KG,

Pls dont drag the post unnecessarily. This is not your ilugc mailing list.

KM

> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django + cherokee configuration problem

2011-01-23 Thread km
On Sun, Jan 23, 2011 at 6:42 PM, Ivo Brodien  wrote:

>
> 1) Accessing http://localhost/myproject  displays the whole hierarchy of
> files in the "myproject" which is not what i want to display.
>  so how do i make "index" function in myapp/views.py render base.html
> as before with cherokee ?
>
>
> looks like you put your django project root as the path for static root
> instead of to mymedia? check your dir settings in the virtual server.
>
> No.
The "document root" of the virtual server points to /path/to/mymedia
and the django project root points to /path/to/myproject
but still i have the same issue.
regards,
KM


>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django + cherokee configuration problem

2011-01-23 Thread km
Hi all,
I am running django (1.2.4) project ("myproject") with an app called
"myapp". The tree looks this way:

myproject
|-- __init__.py
|-- myapp
|   |-- __init__.py
|   |-- models.py
|   |-- templates
|   |   |-- base.html
|   |   |-- base_menu.html
|   |-- tests.py
|   |-- views.py
|-- manage.py
|-- settings.py
|-- urls.py
|-- mymedia
|   |-- css
`-- js

I also have a "templates" dir in "myapp" to hold templates rendered by views
defined in myapps/views.py. Forexample, I could sucessfully render base.html
from "templates" dir using "index" view defined in myapp/views.py when url
http://localhost:8000/index is  accessed. So far so good.

I am porting this  "myproject" to work with cherokee (1.0.18 ppa) on ubuntu
10.10 with python2.6.6.

Cherokee web configuration:
I have defined a virtualhost and  set the "document root" to
/path/to/myproject/mymedia for It hosts jquery and other css to decorate
base.html
I notice two workers on different ports handling csgi protocol: "python
/path/to/myproject/manage.py runfcgi protocol=scgi host=127.0.0.1
port=57698"
I have followed the config settings as defined at
http://www.cherokee-project.com/doc/cookbook_django.html using SCGI

1) Accessing http://localhost/myproject  displays the whole hierarchy of
files in the "myproject" which is not what i want to display.
 so how do i make "index" function in myapp/views.py render base.html as
before with cherokee ?
2) I find only empty logs  in /var/log/cherokee/*.log  and unable to find
the cherokee errors if any. how do i find them ?
3) Do I have to  modify dir/file permissions to "myproject" recursively to
make it work ?
4) The virtual host defined name does not work (viz., www.example.com) when
used as url in a browser.
5) How do I display (render)  "myproject" on the browser using
http://localhost/myproject OR http://www.example.com ? which is the correct
way ?

pls let me know

regards,
KM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: templates - pulling child templates

2011-01-21 Thread km
Hi all,

The docs say we can have multiple child templates extending the parent
template. But then how to render multiple  child templates in one call ?

regards,
KM

On Fri, Jan 21, 2011 at 8:14 PM, km  wrote:

>
> Hi all,
>
> On Fri, Jan 21, 2011 at 6:03 PM, Daniel Roseman wrote:
>
>> On Friday, January 21, 2011 12:08:57 PM UTC, km wrote:
>>>
>>> Hi all,
>>>
>>> I am trying to display a  parent django template (base.html) with a view
>>> function called "base" like this:
>>>
>>> def base(request):
>>>return render_to_response('base.html')
>>>
>>> The base.html gets displayed in the browser(firefox 3.x) but the child
>>> html pages, holding content details, which extend base.html does not get
>>> pulled automatically.
>>> both base.html and child html are in the same dir.
>>> I am using django 1.2.4 on ubuntu 10.10
>>> what could be the problem?
>>>
>>> pls let me know.
>>> regards,
>>> KM
>>>
>>
>> You're doing it the wrong way round. Child templates extend parent
>> templates, so you need to render the child.
>>
> Many thanks for the clarification. that makes it clear.
> regards,
> KM
>
>
>> --
>> DR.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: templates - pulling child templates

2011-01-21 Thread km
Hi all,

On Fri, Jan 21, 2011 at 6:03 PM, Daniel Roseman wrote:

> On Friday, January 21, 2011 12:08:57 PM UTC, km wrote:
>>
>> Hi all,
>>
>> I am trying to display a  parent django template (base.html) with a view
>> function called "base" like this:
>>
>> def base(request):
>>return render_to_response('base.html')
>>
>> The base.html gets displayed in the browser(firefox 3.x) but the child
>> html pages, holding content details, which extend base.html does not get
>> pulled automatically.
>> both base.html and child html are in the same dir.
>> I am using django 1.2.4 on ubuntu 10.10
>> what could be the problem?
>>
>> pls let me know.
>> regards,
>> KM
>>
>
> You're doing it the wrong way round. Child templates extend parent
> templates, so you need to render the child.
>
Many thanks for the clarification. that makes it clear.
regards,
KM


> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



templates - pulling child templates

2011-01-21 Thread km
Hi all,

I am trying to display a  parent django template (base.html) with a view
function called "base" like this:

def base(request):
   return render_to_response('base.html')

The base.html gets displayed in the browser(firefox 3.x) but the child html
pages, holding content details, which extend base.html does not get pulled
automatically.
both base.html and child html are in the same dir.
I am using django 1.2.4 on ubuntu 10.10
what could be the problem?

pls let me know.
regards,
KM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



newbie

2011-01-15 Thread km
I have been reading django forms with media.
But I would like to use the latest jquery (1.4.4) + jquery-ui (1.8.7)
with a django (v1.2.4) based  web-application for forms and ui-design
in general.

1) does the latest jquery installed under MEDIA_ROOT conflict with the
default jquery library(v1.4.2) ?
2) jquery-ui provides widgets otherthan those act on form elements.
for example most jquery widgets manipulate  elements to make tabs
or accordion appear. In that case does the ui-design have to be
manually designed  and restricted to the templates ?

pls let me know.
thank you
regards,
KM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-tagging generic view

2010-01-03 Thread ~km
Hello,

I'm using the `django-tagging`v0.3.0( http://code.google.com/p/django-tagging/
) app for tagging my blog posts (obviously).

Now I wanted to create a view, which takes a tag and returns all
related posts, posts which have the same tag.

My code:

from tagging.views import tagged_object_list

def by_tag(request, tag, *args, **kwargs):
"""Post listing. Only shows posts that belong to specified tags"""
queryset = Post.objects.all()
if not kwargs.has_key('extra_context'):
kwargs['extra_context'] = {}
kwargs['extra_context']['feedurl'] = 'tag/%s' % tag
def tagged_objects(taglist, union):
return tagged_object_list(request, queryset, taglist,
union=union,
  *args, **kwargs)
if '+' in tag:
return tagged_objects(tag.split('+'), False)
else:
return tagged_objects(tag.split('|'), True)

If this gets called giving an *existing* tag, it returns this:

  No Tag found matching "[u'test']".

Is there any better way to do 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: django 1.1 - Fetching month based data.. No data

2009-12-20 Thread ~km
Sorry I couldn't finish it all... Here's the complete post:
http://pastebin.com/f36abac82

--

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 1.1 - Fetching month based data.. No data

2009-12-20 Thread ~km
Problem plot:

I get no data (blog entries) when querying the monthly and daily
archive, making use of the date based generic views from Django 1.1.

Can you see the problem?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Creating a Django project alike stackoverflow.com

2009-12-01 Thread ~km
Thanks for the many, great answers!

First off I'm not surprised that I'm not the first with the idea, but
I'm surprised that there are so many projects running, trying to clone
SO.

Does anyone have experience with SOclone and Co.? I'll be trying it/
them tonight, and see what they're like...

Cheers,
Kenny

--

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.




Creating a Django project alike stackoverflow.com

2009-11-30 Thread ~km
Hello,

I'm a Python enthusiast and Django newbie. I'm trying to develop a
website with an "Ask and Get an Answer"-Interface, with the goal to
get a strong community; see http://stackoverflow.com to get an idea.
For more information on stackoverflow.com see
http://blog.stackoverflow.com/2008/09/what-was-stack-overflow-built-with/

Following questions:

1) Is it possible to realize my idea with Django, managing the traffic
load for 2.000+ user?
2) How long *may* it take to realize the following? I know that's a
very risky relative question, but assuming I'm a regular-skilled
programmer willing to spend +5h a day.

I previously compared other Web frameworks, e.g. Zope, RoR, Gok,
etc.. , with Django and came to the conclusion that Django /seems/ to
be the most mature solution for developing such an idea from scratch.
Do you think Django does the best job for my needs? (I know this is
the wrong place to ask such a question, but comments are welcome.)

Cheers,
Kenny

--

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.




threadlocals, created_by and save problem

2006-09-27 Thread Ganesh KM
Hi,    i am using http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser to automatically add updated_by and created_by info,
class Entry(models.Model):    name = models.CharField('name', maxlength=100)
    content = models.TextField('content')
    created_by = models.ForeignKey(User, related_name='entry_owner', blank=True)    updated_by = models.ForeignKey(User, related_name='entry_last_updated', blank=True)
        class Admin:
    fields = ((None, {
'fields': ('name', 'content')}),)it works when the object is created for the first time, but when i try to update the entry, it is giving a ProgrammingError because of the sql created_by_id=NULL since it is never shown in Admin fields.
presently i am using this hack to get around the error,    def save(self):
    if self.id:    self.created_by = Entry.objects.get(id=
self.id).created_by    self.updated_by = threadlocals.get_current_user()
is there any other approach like disabling updating the created_by_id field once the object is created ?cheers,Ganesh.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---