Re: Spawning long processes

2007-07-05 Thread Oliver Charles

Ahhh, I got it now - Thanks so much Simon! The problem was I had left
out close_fds, so it was still spawning as a child process I think.
With close_fds it works a treat - thank you once again :D

- Ollie

On Jul 5, 3:18 pm, Simon Drabble <[EMAIL PROTECTED]> wrote:
> On Thu, 5 Jul 2007, Oliver Charles wrote:
>
> > That doesn't work, I've tried that, it still hangs the view.
>
> > Give it a shot with a long python script (while True: time.sleep(1)
> > would do) and you'll find that the view never returns. If you can get
> > it to return, I'd love to see your code, but it's no go for me...
>
> Well, modulo the script name & arguments, that's the code I'm using
> successfully to run background processes. How have you verified that
> the view does not return? Does the sub-process actually start (i.e.
> can you see it with ps)? What OS are you using, and have you verified
> that the code you are uring works outside of django (write a small
> shell script that does nothing but call the external torrent process -
> does that work as expected?).
>
> -Simon.
>
>
>
> > On Jul 5, 2:57 pm, Simon Drabble <[EMAIL PROTECTED]> wrote:
> >> On Thu, 5 Jul 2007, Oliver Charles wrote:
>
> >>> Just to give an update, I've tried forking the view, and then turning
> >>> the child process into a daemon with a double fork, and then exiting
> >>> before it gets to the return, and letting the parent do the return,
> >>> but this is not working either...
>
> >>> I'm stumped, and don't really want to have to create a specific
> >>> controller daemon (but guess I'm going to have to)
>
> >>> - Olllie
>
> >> Use the subprocess module:
>
> >> import subprocess
> >> ...
> >> script = 'python'
> >> args = (script, '/path/to/executable', ...)
> >> env = { ... }
> >> pid = subprocess.Popen(args, close_fds=True, env=env).pid
>
> >> t = Torrent.objects.create(pid=pid)
> >> ...
>
> >> Remember to store the pid for later wait()ing or you'll end up with 
> >> zombies.
>
> >> -Simon.
>
> >>> On Jul 5, 2:58 am, Oliver Charles <[EMAIL PROTECTED]> wrote:
> >>>> Hi
>
> >>>> I'm currently playing around trying to make something akin to
> >>>> TorrentFlux, using Django. TorrentFlux is a system that's PHP and it
> >>>> calls shell scripts to download torrents in the background, with a web
> >>>> interface to control them. For every torrent download, a new process
> >>>> is started, which runs with the torrent - downloading and seeding it.
>
> >>>> My system is similar, and i'm at a very proof of concept stage at the
> >>>> moment. However, I've hit a problem. I can't find a nice way to spawn
> >>>> the processes, without Django hanging as long as the process needs
> >>>> (and for 600mb torrents, that's gonna be hours, and endless if seeding
> >>>> is expected).
>
> >>>> At the moment I am doing:
>
> >>>> def start(request):
>
> >>>> p = os.spawnlp(os.P_NOWAIT, 'python', 'python', '/Users/acid/Work/
> >>>> dTorrent/btdownloadheadless',
> >>>> '/Users/acid/Desktop/Inbox/-{mininova.org}- Professional C+
> >>>> +.torrent')
>
> >>>> t = Torrent.objects.create(pid=p)
>
> >>>> return HttpResponse(str(p))
>
> >>>> But this is hanging, despite the P_NOWAIT (the Torrent model does get
> >>>> created).
>
> >>>> Any ideas?
>
> >> --
>
> --


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



Re: Spawning long processes

2007-07-05 Thread Oliver Charles

That doesn't work, I've tried that, it still hangs the view.

Give it a shot with a long python script (while True: time.sleep(1)
would do) and you'll find that the view never returns. If you can get
it to return, I'd love to see your code, but it's no go for me...

On Jul 5, 2:57 pm, Simon Drabble <[EMAIL PROTECTED]> wrote:
> On Thu, 5 Jul 2007, Oliver Charles wrote:
>
> > Just to give an update, I've tried forking the view, and then turning
> > the child process into a daemon with a double fork, and then exiting
> > before it gets to the return, and letting the parent do the return,
> > but this is not working either...
>
> > I'm stumped, and don't really want to have to create a specific
> > controller daemon (but guess I'm going to have to)
>
> > - Olllie
>
> Use the subprocess module:
>
> import subprocess
> ...
> script = 'python'
> args = (script, '/path/to/executable', ...)
> env = { ... }
> pid = subprocess.Popen(args, close_fds=True, env=env).pid
>
> t = Torrent.objects.create(pid=pid)
> ...
>
> Remember to store the pid for later wait()ing or you'll end up with zombies.
>
> -Simon.
>
>
>
>
>
> > On Jul 5, 2:58 am, Oliver Charles <[EMAIL PROTECTED]> wrote:
> >> Hi
>
> >> I'm currently playing around trying to make something akin to
> >> TorrentFlux, using Django. TorrentFlux is a system that's PHP and it
> >> calls shell scripts to download torrents in the background, with a web
> >> interface to control them. For every torrent download, a new process
> >> is started, which runs with the torrent - downloading and seeding it.
>
> >> My system is similar, and i'm at a very proof of concept stage at the
> >> moment. However, I've hit a problem. I can't find a nice way to spawn
> >> the processes, without Django hanging as long as the process needs
> >> (and for 600mb torrents, that's gonna be hours, and endless if seeding
> >> is expected).
>
> >> At the moment I am doing:
>
> >> def start(request):
>
> >> p = os.spawnlp(os.P_NOWAIT, 'python', 'python', '/Users/acid/Work/
> >> dTorrent/btdownloadheadless',
> >> '/Users/acid/Desktop/Inbox/-{mininova.org}- Professional C+
> >> +.torrent')
>
> >> t = Torrent.objects.create(pid=p)
>
> >> return HttpResponse(str(p))
>
> >> But this is hanging, despite the P_NOWAIT (the Torrent model does get
> >> created).
>
> >> Any ideas?
>
> --


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



Re: Spawning long processes

2007-07-05 Thread Oliver Charles

Just to give an update, I've tried forking the view, and then turning
the child process into a daemon with a double fork, and then exiting
before it gets to the return, and letting the parent do the return,
but this is not working either...

I'm stumped, and don't really want to have to create a specific
controller daemon (but guess I'm going to have to)

- Olllie

On Jul 5, 2:58 am, Oliver Charles <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm currently playing around trying to make something akin to
> TorrentFlux, using Django. TorrentFlux is a system that's PHP and it
> calls shell scripts to download torrents in the background, with a web
> interface to control them. For every torrent download, a new process
> is started, which runs with the torrent - downloading and seeding it.
>
> My system is similar, and i'm at a very proof of concept stage at the
> moment. However, I've hit a problem. I can't find a nice way to spawn
> the processes, without Django hanging as long as the process needs
> (and for 600mb torrents, that's gonna be hours, and endless if seeding
> is expected).
>
> At the moment I am doing:
>
> def start(request):
>
> p = os.spawnlp(os.P_NOWAIT, 'python', 'python', '/Users/acid/Work/
> dTorrent/btdownloadheadless',
> '/Users/acid/Desktop/Inbox/-{mininova.org}- Professional C+
> +.torrent')
>
> t = Torrent.objects.create(pid=p)
>
> return HttpResponse(str(p))
>
> But this is hanging, despite the P_NOWAIT (the Torrent model does get
> created).
>
> Any ideas?


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



Spawning long processes

2007-07-04 Thread Oliver Charles

Hi

I'm currently playing around trying to make something akin to
TorrentFlux, using Django. TorrentFlux is a system that's PHP and it
calls shell scripts to download torrents in the background, with a web
interface to control them. For every torrent download, a new process
is started, which runs with the torrent - downloading and seeding it.

My system is similar, and i'm at a very proof of concept stage at the
moment. However, I've hit a problem. I can't find a nice way to spawn
the processes, without Django hanging as long as the process needs
(and for 600mb torrents, that's gonna be hours, and endless if seeding
is expected).

At the moment I am doing:

def start(request):

p = os.spawnlp(os.P_NOWAIT, 'python', 'python', '/Users/acid/Work/
dTorrent/btdownloadheadless',
'/Users/acid/Desktop/Inbox/-{mininova.org}- Professional C+
+.torrent')

t = Torrent.objects.create(pid=p)

return HttpResponse(str(p))

But this is hanging, despite the P_NOWAIT (the Torrent model does get
created).


Any ideas?


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



Re: get the latest # of objects

2007-04-22 Thread Oliver Charles

Try Entries.objects.order_by('a_field_that_you_want_to_order_by')[:5]

Entries.objects is a query set manager, not a query set, so you can't 
slice that.

--
Ollie
> hm. I'm trying to do this in a context processor and its not working:
>
> def entry_latest(request):
> from app.entries.models import Entries
> return {'entry_latest': Entries.objects[:5]}
>
>
> On Apr 22, 2:35 pm, "Honza Král" <[EMAIL PROTECTED]> wrote:
>   
>> just slice it:
>> entry_list[:5]
>>
>> just bear in mind that slicing will actually query the database, so
>> you need to do it when working with the data (e.g. not in urls.py when
>> providing parameters for generic views)
>>
>> On 4/22/07, drackett <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>
>>
>> 
>>> I love the ability to get the latest object in a collection..
>>>   
>>> entry_list.latest()
>>>   
>>> and was curious if there is a way to get more than 1 object. For
>>> example, if I want the last 5 entries of a blog, is there something
>>> like
>>>   
>>> entry_list.latest(5)
>>>   
>>> I know that doesn't work, but is there an easy way to do this?
>>>   
>> --
>> Honza Kr?l
>> E-Mail: [EMAIL PROTECTED]
>> ICQ#:   107471613
>> Phone:  +420 606 678585
>> 
>
>
> >   


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



Re: Another take on auto-history

2007-04-22 Thread Oliver Charles

Damnit, that's what you get for trying to run several projects under one 
vhost on apache! It's fixed now, sorry about that

http://acid2.user.openhosting.com/static/history-latest.zip

The history app itself is in a directory called history_contrib - that 
zip files contains the whole example app as well.


--
Ollie
> Looks like the download link is broken.
>
> On Apr 21, 4:24 am, Oliver Charles <[EMAIL PROTECTED]> wrote:
>   
>> Morning all
>>
>> I've been meaning to post this to the list for a while, and I think my
>> code is now ready to be shown. I've been working on a small bug tracker
>> type project for myself - as I have 3 Django projects on the go at the
>> moment. Anyway, I wanted a way to track changes made to bugs/tickets so
>> I made this automatic history decorator. It works by logging revisions
>> of fields on a model, so you can specific which fields should have a
>> history, etc.
>>
>> I haven't included rollback support yet, but if people are interested, I
>> will happily look into offering it (shouldn't be hard!) Without furthor
>> ado, here is the website, with a mini example application too:
>>
>> http://acid2.user.openhosting.com/history/
>>
>> The way that my auto history module works is through decorating the
>> save() method of a model. Everytime you save a model, it looks up the
>> model in the database first. Then, each field is compared and log
>> entries are made. You can then retrieve a list of these changes through
>> the models provided (see the example in the zip).
>>
>> This was mainly an experiment to learn introspection and metaprogramming
>> type stuff in Python, but if anyone has any ideas on what could improve
>> this, I'd love to hear them.
>>
>> Thanks, hope someone finds it useful!
>>
>> --
>> Oliver Charles
>> 
>
>
> >   


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



Re: reverse relationships with ForeignKey?

2007-04-21 Thread Oliver Charles

Thats' because by default Django will name the field "model_set" on the 
reverse relationship. So if you want to access it that way, you should 
do entry.updates_set.all(). A nicer, more readable way, is to set 
related_name on the ForeignKey. E.g: entry = models.ForeignKey(Entry, 
related_name="updates") (This is a field in your Updates model)

Hope this helps!

--
Ollie
> I have an app that I'm building and I've run into a problem. I have 2
> models "Entries" and "Updates" which points to "Entries" with a
> ForeignKey. The idea is that an entry can be updated at multiple times
> and I track the date and other meta information of the update within
> the update model.
>
> When I try and create the detail template I can't seem to find a way
> to list the updates for an entry. Here is the code I am trying to use:
>
> {% for update in entry.updates.all %}
> {{update.body}}
> {% endfor %}
>
> sadly this has no effect.. Any help would be much appriciated :)
>
>
> >   


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



Another take on auto-history

2007-04-21 Thread Oliver Charles

Morning all

I've been meaning to post this to the list for a while, and I think my 
code is now ready to be shown. I've been working on a small bug tracker 
type project for myself - as I have 3 Django projects on the go at the 
moment. Anyway, I wanted a way to track changes made to bugs/tickets so 
I made this automatic history decorator. It works by logging revisions 
of fields on a model, so you can specific which fields should have a 
history, etc.

I haven't included rollback support yet, but if people are interested, I 
will happily look into offering it (shouldn't be hard!) Without furthor 
ado, here is the website, with a mini example application too:

http://acid2.user.openhosting.com/history/

The way that my auto history module works is through decorating the 
save() method of a model. Everytime you save a model, it looks up the 
model in the database first. Then, each field is compared and log 
entries are made. You can then retrieve a list of these changes through 
the models provided (see the example in the zip).

This was mainly an experiment to learn introspection and metaprogramming 
type stuff in Python, but if anyone has any ideas on what could improve 
this, I'd love to hear them.

Thanks, hope someone finds it useful!

--
Oliver Charles

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



Re: how to connect Django to objects served over xml-rpc?

2007-04-21 Thread Oliver Charles

Hey, seeing as you haven't had any relies yet, I will through my idea down.

What I think you're gonna have to do for the most graceful version is to 
create your own database wrapper, that calls xml-rpc, instead of an 
actual database. Then Django *should* be free to use. The problem may 
occur that Django really does expect to see database like data, so you 
may have to reformat your data.

My only other idea is to extend the model base class, and replacement 
the save function, etc. This will get messy though, because QuerySet's 
also use the db api, so it would require rewriting them too.

I think that option 1 is your best bet, and looking at the SQLite 
wrapper should make stuff easier.

Hope this helps
--
Ollie
> I want to try out Django for a small project, hoping to discover that
> it will be the web framework of my dreams, but I need some advice.
>
> My project group has written an xml-rpc API in front of our database
> and password stores.  This means that when we want to, say, create a
> campus guest account, we call xml-rpc functions like create_guest(),
> set_guest_info(), and set_account_password(), and those functions do
> all of the database operations (and sometimes operations on other
> systems) needed to perform each operation consistently (creating a
> guest requires at least six tables to be updated, for example).
>
> This is great in two ways.  First, our business logic is all in one
> place, where complex operations get written once, correctly.  Second,
> we wrote it in simple, plain Python that we could all agree upon, so
> that now each front-end and client can be written in the favorite
> language and framework of the group deploying it (so long as it talks
> xml-rpc), avoiding the need for a religious war and everyone being
> forced to use One True Platform.
>
> The problem is that Django seems to really, really want to talk to the
> database by itself. :-)
>
> At what level, then, would I subvert Django if, say, a Guest were not
> a row in a database table, but an entity that I get information about
> from an xml-rpc call, and for which some other xml-rpc calls let me
> set information?  Thanks for any guidance!
>
> I'll be happy to write up my solution for the Django documentation
> page, which already discusses connecting to a legacy database - but
> not a ... what would one call it?  A "legacy non-database."
>
>   


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



Re: Django Urls object_id/xxxxxx/object_id

2007-04-20 Thread Oliver Charles

Just write your own view that in turn calls a generic view? Create a new 
view, with a similiar signiture, but change the object_id for team_id 
AND result_id. Then, do a bit of logic to find the query set you need a 
view of, and pass this through to a generic view, and then return this.

Hope this helps!

--
Ollie
> Thanks for the help Tim, however I've tried that and it doesn't work :
> (
>
> Is there any other way you could think of achieving it, even if it
> doesn't use generic views and urls?
>
> Thanks,
> Duncan
>
>
> >   


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



Re: multiple urls for the same view?

2007-04-20 Thread Oliver Charles

No, what I mean is more like this. You have one set of urls that act 
like a master. Each url should be
similar to

('something/$', 'view-handler')

Notice that it doesn't use ^, so it will match anywhere. Then, on your 
seperate sites, you have a site
specific url config that includes this master url file, so you can have 
the urls with anything else before
them. So if the site specific looked like:

urlpatterns = ('', ('^dev1/', include('appurls'))

Then the url /dev1/something/ would be matched, but you could change 
dev1 to dev2 and it
would still match.

Please let me know if I've misunderstood what you're trying to do, but I 
hope this clears what I
meant up.
--
Ollie
> Wouldn't that just be the same thing, except 4 copies of them exist in
> appurls.py instead of urls.py?
>
> My urls.py is in my source control tree, because there are so many of
> them, we each pull it down.  I know we could take it out of source
> control and hand change it each time to have /dev1 or /dev2 (which we
> may have to do since you can't have more than 255 anyway), but that is
> going to get old quick, so I was hoping there was a way to tell it to
> append from a setting or something...
>
> On Apr 20, 10:53 am, Oliver Charles <[EMAIL PROTECTED]> wrote:
>   
>> Yea, there is a way. If you take all your url out, and move them into an
>> appurls.py file or something,
>> you can include this from the main urlpatterns. E.g:
>>
>> urlpatterns = ('', ('^yourprefixhere/',
>> include('pythonpathtoproject.appurls'))
>>
>> I think that should work - there might be other ways though.
>>
>> --
>> Ollie
>>
>> 
>>> Ok...that fixed that problem...
>>>   
>>> Is there any better way to handle the urls.py file though...than
>>> putting different versions of each url?  I currently have about 100
>>> urls...and I'm going to have to put 4 versions in for each..seems like
>>> there should be an easer way to append something to the front of each
>>> based on a setting...
>>>   
>>> sitename/something
>>> dev1/sitename/something
>>> dev2/sitename/something
>>> etc..
>>>   
>>> On Apr 20, 6:47 am, Graham Dumpleton <[EMAIL PROTECTED]>
>>> wrote:
>>>   
>>>> You need to set PythonInterpreter directive in each Location container
>>>> directive with a different value in each case. This is so that each
>>>> Django instance runs in its own Python sub interpreter. You should
>>>> also change your settings.py file for each and set SESSION_COOKIE_NAME
>>>> to a different value for each so their respective cookies don't
>>>> interfere with each other.
>>>> 
>>>> Graham
>>>> 
>>>> On Apr 20, 4:11 pm, "[EMAIL PROTECTED]"
>>>> 
>>>> <[EMAIL PROTECTED]> wrote:
>>>> 
>>>>> Also...it seems if I have two instances of this running on the same
>>>>> apache server...that one sporadically  looks at the wrong urls.py file
>>>>> ( the one for another instance )
>>>>>   
>>>>> Is it not valid to do the following in the apache conf file?
>>>>>   
>>>>> 
>>>>> SetHandler python-program
>>>>> PythonHandler django.core.handlers.modpython
>>>>> SetEnv DJANGO_SETTINGS_MODULE rssproject.settings
>>>>> PythonDebug On
>>>>> PythonPath "['/home/somedir/','home/somedir/projectname/'] +
>>>>> sys.path"
>>>>> 
>>>>>   
>>>>> 
>>>>> SetHandler python-program
>>>>> PythonHandler django.core.handlers.modpython
>>>>> SetEnv DJANGO_SETTINGS_MODULE rssproject.settings
>>>>> PythonDebug On
>>>>> PythonPath "['/home/dev1/','home/dev1/projectname/'] + sys.path"
>>>>> 
>>>>>   
>>>>> On Apr 20, 12:31 am, "[EMAIL PROTECTED]"
>>>>>   
>>>>> <[EMAIL PROTECTED]> wrote:
>>>>>   
>>>>>> I don't think I can convince our network guys to do that... they
>>>>>> prefer not to open anymore ports than necessary.
>>>>>> 
>>>>>> On Apr 20, 12:28 am, "Julio Nobrega" <[EMAIL PROTECTED]> wrote:
>>>>>> 
>>>>>>>   You could use different directories (Django projects) under multiple
>>>>>>> VirtualServers (different domain names / ports), each one for a
>>>>>>> particular developer.
>>>>>>>   
>>>>>>> On 4/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>>>>>>   
>>>>>>>> I'm trying to setup three development directories for different
>>>>>>>> programmers, for us each to be able to checkout our project to from
>>>>>>>> svn on the same development machine...
>>>>>>>> 
>>>>>>> --
>>>>>>> Julio Nobrega -http://www.inerciasensorial.com.br
>>>>>>>   
>
>
> >   


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



Re: multiple urls for the same view?

2007-04-20 Thread Oliver Charles

Yea, there is a way. If you take all your url out, and move them into an 
appurls.py file or something,
you can include this from the main urlpatterns. E.g:

urlpatterns = ('', ('^yourprefixhere/', 
include('pythonpathtoproject.appurls'))

I think that should work - there might be other ways though.

--
Ollie
> Ok...that fixed that problem...
>
> Is there any better way to handle the urls.py file though...than
> putting different versions of each url?  I currently have about 100
> urls...and I'm going to have to put 4 versions in for each..seems like
> there should be an easer way to append something to the front of each
> based on a setting...
>
> sitename/something
> dev1/sitename/something
> dev2/sitename/something
> etc..
>
>
> On Apr 20, 6:47 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>   
>> You need to set PythonInterpreter directive in each Location container
>> directive with a different value in each case. This is so that each
>> Django instance runs in its own Python sub interpreter. You should
>> also change your settings.py file for each and set SESSION_COOKIE_NAME
>> to a different value for each so their respective cookies don't
>> interfere with each other.
>>
>> Graham
>>
>> On Apr 20, 4:11 pm, "[EMAIL PROTECTED]"
>>
>> <[EMAIL PROTECTED]> wrote:
>> 
>>> Also...it seems if I have two instances of this running on the same
>>> apache server...that one sporadically  looks at the wrong urls.py file
>>> ( the one for another instance )
>>>   
>>> Is it not valid to do the following in the apache conf file?
>>>   
>>> 
>>> SetHandler python-program
>>> PythonHandler django.core.handlers.modpython
>>> SetEnv DJANGO_SETTINGS_MODULE rssproject.settings
>>> PythonDebug On
>>> PythonPath "['/home/somedir/','home/somedir/projectname/'] +
>>> sys.path"
>>> 
>>>   
>>> 
>>> SetHandler python-program
>>> PythonHandler django.core.handlers.modpython
>>> SetEnv DJANGO_SETTINGS_MODULE rssproject.settings
>>> PythonDebug On
>>> PythonPath "['/home/dev1/','home/dev1/projectname/'] + sys.path"
>>> 
>>>   
>>> On Apr 20, 12:31 am, "[EMAIL PROTECTED]"
>>>   
>>> <[EMAIL PROTECTED]> wrote:
>>>   
 I don't think I can convince our network guys to do that... they
 prefer not to open anymore ports than necessary.
 
 On Apr 20, 12:28 am, "Julio Nobrega" <[EMAIL PROTECTED]> wrote:
 
>   You could use different directories (Django projects) under multiple
> VirtualServers (different domain names / ports), each one for a
> particular developer.
>   
> On 4/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>   
>> I'm trying to setup three development directories for different
>> programmers, for us each to be able to checkout our project to from
>> svn on the same development machine...
>> 
> --
> Julio Nobrega -http://www.inerciasensorial.com.br
>   
>
>
> >   


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



Re: Django Schema Migration

2007-04-20 Thread Oliver Charles

Hey, this is neat!

It's just a shame that it doesn't use Python models or some type of 
database agnostic representation - any plans there?

Great work non the less though!

-- 
Ollie
> Hi all,
>
> Release 0.01 of the migration module can be downloaded from
> http://www.aswmc.com/dbmigration/
> as well as a patch to integrate it into the syncdb command.
>
> It seems to be working well for the developers here, so here's hoping
> it's useful for some other people too :)
>
> MikeH
>
> >   


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



Re: Extending the User model

2007-04-19 Thread Oliver Charles

I suppose the best bet, in an ideal world, world be model inheritance.
As you're probably aware, this is incomplete at the moment, so you
can't really do that. A better solution may be to have a wrapper
model, and have your Buyer/Seller classes create one to one
relationship this extension class. To top things off, one-to-one is
also going to be changing syntax soon.. but I think this is your best
bet for now...

class UserExtension(models.Model):
pass

class Buyer(models.Model):
# Buyer specific profile data here
pass

Then, you could set AUTH_PROFILE_MODULE. To keep your code pretty dry,
you'll probably want to have a "get_data" method in UserExtension:

def get_data(self):
if self.buyer:
return self.buyer
if self.seller:
return self.seller
return None # No profile data


I'm also looking for a nice solution to this, as I'Hope this helps


On Apr 19, 9:05 am, checco <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I already posted this question 
> herehttp://groups.google.com/group/django-users/browse_thread/thread/2dfb...
> but I then realized I had not been very clear and decided to rewrite
> it.
>
> In this entry from the James Bennet 
> bloghttp://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-mo...
> are clear instructions on how to extend the User model to fit the
> particular needs of an application.
>
> In the application I'm developing there two different kind of users,
> for example a Buyer and a Seller, which have different fields. This
> means that I have to extend the User model twice. The problem I'm
> facing is: which value should I specify for the parameter
> AUTH_PROFILE_MODULE in settings.py? 'myapp.Buyer', 'myapp.Seller',
> both of them?
>
> Any help will be appreciated
> Francesco


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



Re: ImportError: no module named django

2007-04-18 Thread Oliver Charles

Ok, I took the last email private with Rob, and got it sorted! It
seemed that apache couldn't access any files in /home/acid2, so the
solution has been to move everything into /opt/django, so I did:

sudo mv /home/acid2/src/django_src/ /opt/django/src/
sudo rm /usr/lib/python2.4/site-packages/django
sudo ln -s /opt/django_src/django /usr/lib/python2.4/site-packages/
django

Also, I store my projects and their templates in /opt/django_projects
and /opt/django_templates, respectivly.

Quick hint that i'll pass on from Rob (that I'm sure many people know)
- settings.py contains sensitive information, so I have made this
private with:
chmod 0750 /whatever/settings.py
chown root:apache /whatever/settings.py

Now it's read/write/execute for root, and only read/execute for
apache.


Hurrah! Big thanks to Rob for helping me get this fixed!

- Oliver Charles

On Apr 18, 10:10 pm, Oliver Charles <[EMAIL PROTECTED]> wrote:
> I get...
>
> [EMAIL PROTECTED] ~]$ sudo -u apache python
> Password:
> Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
> [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import django
>
> Traceback (most recent call last):
>   File "", line 1, in ?
> ImportError: No module named django>>> import sys
> >>> sys.path
>
> ['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/
> python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/
> python2.4/lib-dynload', '/usr/lib/python2.4/site-packages']
>
> So this is the problem I guess - apache can't access django, but I'm
> not sure why... any ideas?
>
> oggie rob: Nah, I'm not discouraged, I really like there attidue...
> linux isn't my forte though it seems!
>
> --
> Ollie
>
> On Apr 18, 10:05 pm, oggie rob <[EMAIL PROTECTED]> wrote:
>
> > What happens when you run:
> > sudo -u apache python>>> import django
> > >>> django
>
> >  > __init__.pyc'>
>
> > BTW, I use openhosting and have a few django sites running so don't be
> > discouraged!
>
> >  -rob
>
> > On Apr 18, 12:59 pm, Oliver Charles <[EMAIL PROTECTED]> wrote:
>
> > > Ok,
>
> > > I've done a ton of googling on this, and not come up with much luck.
> > > Here's my situation:
>
> > > I've just purchased a new VPS from OpenHosting for a project, and it
> > > comes with mod_python, apache2 and postgresql all setup. So I did a
> > > subversion checkout of django, and symlinked it to /usr/lib/python2.4/
> > > site-packages, which I can verify:
>
> > > [EMAIL PROTECTED] ~]$ ls -al /usr/lib/python2.4/site-packages/ | grep
> > > django
> > > lrwxrwxrwx  1 root root 33 Apr 18 14:27 django -> /home/acid2/src/
> > > django_src/django
>
> > > So that looks ok, and just to make sure, here's django_src/django:
>
> > > [EMAIL PROTECTED] ~]$ ls -al ~/src/django_src/ | grep django
> > > drwxr-xr-x 20 acid2 acid2 4096 Apr 18 14:27 django
>
> > > So, with django now symlinked to my site-packages, I tried importing
> > > it in the python shell:
>
> > > [EMAIL PROTECTED] ~]$ python
> > > Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
> > > [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
> > > Type "help", "copyright", "credits" or "license" for more information.
>
> > > >>> import django
>
> > > Looks good! So I now went to add this into my Apache config:
>
> > > 
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > #SetEnv DJANGO_SETTINGS_MODULE trainspotted.settings
> > > PythonDebug On
> > > PythonPath "sys.path"
> > > 
>
> > > Of course, now when I go to my apache site I get:
>
> > > Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> > > Traceback (most recent call last):
> > > 
>
> > > ImportError: No module named django
>
> > > I can't see for the life of me why this is happening. Django is
> > > readable everywhere, python can import is from the shell, and sys.path
> > > contains a django directory, with __init__.py...
>
> > > Can anyone see why I can't get the import to work? I'm banging my head
> > > on this one!
>
> > > ---
> > > Oliver Charles


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



Re: ImportError: no module named django

2007-04-18 Thread Oliver Charles

I get...

[EMAIL PROTECTED] ~]$ sudo -u apache python
Password:
Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named django
>>> import sys
>>> sys.path
['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/
python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/
python2.4/lib-dynload', '/usr/lib/python2.4/site-packages']

So this is the problem I guess - apache can't access django, but I'm
not sure why... any ideas?

oggie rob: Nah, I'm not discouraged, I really like there attidue...
linux isn't my forte though it seems!

--
Ollie


On Apr 18, 10:05 pm, oggie rob <[EMAIL PROTECTED]> wrote:
> What happens when you run:
> sudo -u apache python>>> import django
> >>> django
>
>  __init__.pyc'>
>
> BTW, I use openhosting and have a few django sites running so don't be
> discouraged!
>
>  -rob
>
> On Apr 18, 12:59 pm, Oliver Charles <[EMAIL PROTECTED]> wrote:
>
> > Ok,
>
> > I've done a ton of googling on this, and not come up with much luck.
> > Here's my situation:
>
> > I've just purchased a new VPS from OpenHosting for a project, and it
> > comes with mod_python, apache2 and postgresql all setup. So I did a
> > subversion checkout of django, and symlinked it to /usr/lib/python2.4/
> > site-packages, which I can verify:
>
> > [EMAIL PROTECTED] ~]$ ls -al /usr/lib/python2.4/site-packages/ | grep
> > django
> > lrwxrwxrwx  1 root root 33 Apr 18 14:27 django -> /home/acid2/src/
> > django_src/django
>
> > So that looks ok, and just to make sure, here's django_src/django:
>
> > [EMAIL PROTECTED] ~]$ ls -al ~/src/django_src/ | grep django
> > drwxr-xr-x 20 acid2 acid2 4096 Apr 18 14:27 django
>
> > So, with django now symlinked to my site-packages, I tried importing
> > it in the python shell:
>
> > [EMAIL PROTECTED] ~]$ python
> > Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
> > [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
>
> > >>> import django
>
> > Looks good! So I now went to add this into my Apache config:
>
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > #SetEnv DJANGO_SETTINGS_MODULE trainspotted.settings
> > PythonDebug On
> > PythonPath "sys.path"
> > 
>
> > Of course, now when I go to my apache site I get:
>
> > Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> > Traceback (most recent call last):
> > 
>
> > ImportError: No module named django
>
> > I can't see for the life of me why this is happening. Django is
> > readable everywhere, python can import is from the shell, and sys.path
> > contains a django directory, with __init__.py...
>
> > Can anyone see why I can't get the import to work? I'm banging my head
> > on this one!
>
> > ---
> > Oliver Charles


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



ImportError: no module named django

2007-04-18 Thread Oliver Charles

Ok,

I've done a ton of googling on this, and not come up with much luck.
Here's my situation:

I've just purchased a new VPS from OpenHosting for a project, and it
comes with mod_python, apache2 and postgresql all setup. So I did a
subversion checkout of django, and symlinked it to /usr/lib/python2.4/
site-packages, which I can verify:

[EMAIL PROTECTED] ~]$ ls -al /usr/lib/python2.4/site-packages/ | grep
django
lrwxrwxrwx  1 root root 33 Apr 18 14:27 django -> /home/acid2/src/
django_src/django

So that looks ok, and just to make sure, here's django_src/django:

[EMAIL PROTECTED] ~]$ ls -al ~/src/django_src/ | grep django
drwxr-xr-x 20 acid2 acid2 4096 Apr 18 14:27 django


So, with django now symlinked to my site-packages, I tried importing
it in the python shell:

[EMAIL PROTECTED] ~]$ python
Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>

Looks good! So I now went to add this into my Apache config:


SetHandler python-program
PythonHandler django.core.handlers.modpython
#SetEnv DJANGO_SETTINGS_MODULE trainspotted.settings
PythonDebug On
PythonPath "sys.path"



Of course, now when I go to my apache site I get:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):


ImportError: No module named django


I can't see for the life of me why this is happening. Django is
readable everywhere, python can import is from the shell, and sys.path
contains a django directory, with __init__.py...

Can anyone see why I can't get the import to work? I'm banging my head
on this one!

---
Oliver Charles


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



Extending feeds with Apple iTunes information?

2007-02-16 Thread Oliver Charles

I'm using the feed system to do a podcast, and it's up on the iTunes
Store as well. But I'd like to make it more user friendly, taking
advantage of the images that are supported, and extended meta data. Is
there anyway to add my own namespaces into the feeds, or am I going to
have to get my hands dirty with Django's internals and add that
myself?

Thanks,
Ollie


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