best practices for a production site

2008-01-17 Thread Kenneth Gonsalves

hi,

I have a site in production and being developed at the same time - a  
common django usecase I am sure. This is the first time I am  
developing a site with a team comprised of several remote  
contributors also. My previous teams were all in the same lab.  
Currently everyone with commit rights commits code to the repository.  
I test it out on the setup on my local box, and if satisfactory do an  
svn up on the server and restart apache. The problem is that there  
are two types of changes in code - one is new features and the other  
is minor changes. With the current setup, minor changes have to wait  
until the new features are tested out. So even a spelling mistake has  
to wait until whatever is already committed is tested and accepted.  
At the same time, the new features do not really justify setting up  
separate branches. So what would be the best way out of this?
-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread SamFeltus

Django generates the shiniest, happiest pages of any web framework...

:)

http://samfeltus.com/pythonista/MardiGrasPreview.html


--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread Kenneth Gonsalves


On 18-Jan-08, at 12:20 AM, LRP wrote:

> I'm still having a problem since my shell can't seem to find django-
> admin.py. I know it's there; found it in /usr/share/python-support/
> python-django/django/bin.

this will not be on your path - and why debian packagers created that  
weird directory is beyond me
>
> Then there's Kenneth Gonzales. All I can say is, "hey dude, that's not
> very friendly."

well, I was one of the people who told you *not* to rely on debian's  
apt-get for installing django - django is developing too fast for  
package managers to keep up with. So, if, inspite of everything you  
want to use django, please install an uptodate version without apt-get.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread [EMAIL PROTECTED]


> TurboGears would be a terrible choice.  Python does not do well on threads
> and has been known to lock up solid when executing a fork() out of a
> thread.  Also, unless you feel your webserver should use very little of
> your computers resources, the threaded approach of TurboGears may not give
> you what you want.  Python folk made a design decision way back to
> implement a Global Interpreter Lock that means one thread runs at a time
> in any process, even if you have 100 threads and 32 processor cores, one
> thread will be running on one processor.  So while TurboGears has a very
> short learning curve, it is not really for production performance.

The standard way to deploy turbogears on high performance sites is to
run several multi-threaded turbogears instances on the same box, and
load balance them behind apache, ngnx, or some other reverse proxy
server.

This configuration scales quite well, as you get more concurrency per
process than you would in a single threaded python web server,
(particularly because lots of time is spent in network IO, or dababase
IO, which don't block other threads) and ultimately you get less
memory overhead for the same number of concurrent connections.

Of course, this takes a little bit of work, but you setup a multi-
process TurboGears deployment in a few min.

--Your friendly neighborhood TurboGears man
(he does things only a turbogear can...?)

--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]

Thanks Rock. Little less convenient from a file management standpoint,
but it works.

On Jan 17, 7:06 pm, Rock <[EMAIL PROTECTED]> wrote:
> Put shared in site-packages right alongside django. Problem solved.
--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]

I'm not sure that I see how this would be any different than adding
the correct directory to the pythonpath.

On Jan 17, 7:06 pm, Rock <[EMAIL PROTECTED]> wrote:
> Put shared in site-packages right alongside django. Problem solved.
--~--~-~--~~~---~--~~
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 multi application, multi database, need to sync..

2008-01-17 Thread otonk

> Create the sync script using the Python DB API directly (no Django
> ORM). And then trigger it either automatically with the cron job or
> manually, by wrapping that script inside django view. You may want to
> add `modified` DateTimeField to all your Django models and store the
> last sync date/time somewhere. So the sync script should only SELECT
> records from master database where 'modified' is greater than last
> sync date and INSERT/UPDATE it into other database.

cool thanks Ivan..
--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread Rock


Put shared in site-packages right alongside django. Problem solved.

--~--~-~--~~~---~--~~
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 Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread Rock


The templates have to be within a directory named "templates" found in
the /var/www/ directory.
BUT DON'T PUT TEMPLATES THERE! Put the templates dir in the same
directory as your settings.py
file and set the path accordingly in the settings.py file.


Here is another good alternative:

Comment out the filesystem loading option. This means that the second
loader (which is the
app_directories template loader) will be used exclusively. Now put
your templates file within
your application directory, i.e., myapp/templates/ and put the
templates in there. Now you
don't have to specify an absolute path in the settings.py file for
template loading.

--~--~-~--~~~---~--~~
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: about dpaste

2008-01-17 Thread Collin Grady

On Jan 17, 6:28 am, "Lic. José M. Rodriguez Bacallao"
<[EMAIL PROTECTED]> wrote:
> Hi folks, I need to know how can I search, explore for codes 
> inhttp://dpaste.com/
> I really can't figure out how.

You can't - it is not a database of snippets like djangosnippets.org,
but instead a pastebin - pastebins are used for quick sharing or for
asking for help, so you wouldn't want to use most of the code there
(as it would be broken)
--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread Collin Grady

On Jan 17, 4:01 pm, LRP <[EMAIL PROTECTED]> wrote:
> Hmmm, I'm wondering... I'd have little to contribute beyond my
> personal blunders, but I'd be delighted to work with any folks who'd
> like to prepare a Debian-specific addendum to the on-line Django
> tutorial.

Personally, I don't think the tutorial needs distro-specific help - it
would quickly balloon to a much larger size if other packages do it
differently.

The documentation is written assuming you installed it by following
the docs - if you choose to do so in another method, you must adapt to
fit that.
--~--~-~--~~~---~--~~
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 Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread Karen Tracey
On Jan 17, 2008 2:08 PM, code_berzerker <[EMAIL PROTECTED]> wrote:

> > So, though the settings.py you posted has TEMPLATE_DIRS with your '/
> > var/www...'directory listed, the one you are running with has no
> > TEMPLATE_DIRS.
>
> Yes I've noticed that, but I use settings.py listed above. Django uses
> db configuration from that file and other things too. Somehow
> TEMPLATE_DIRS gets cleared or filtered. for example if I run python
> manage.py shell from project dir and inspect settings module it is
> empty. I'm kinda new to Python and Django, so I may actually do some
> stupid mistake on the way. I'm getting frustrated enough to convinve
> myself to use pdb to run that code step by step. I dont know how to
> use pdb and it scares me yet Still considering installing Django
> on windows and trying to debug it through Eric or SPE (but since winxp
> is different platform I can get different issues and that holds me off
> it).
>

Check the value of settings.__file__ from python manage.py shell after
importing settings, just to make sure it is using the file you think it is.
I don't see any code in Django that would filter or clear that setting, so
my first inclination is to think it is using some other settings file than
what you are expecting.

I can't help with pdb, coming most recently from a Java background to Django
I already had Eclipse up and running and it was easy enough to add PyDev to
that for debugging Django stuff, so that is what I tend to use.

BTW if it does matter I've setup Ubuntu (just shell, no X-Windows) on
> VMWare and using it as development server from windows xp.
>

I don't know of any reason why that shouldn't work, but it is outside my
experience.  I develop primarily on Ubuntu, but also have a couple spare old
Windows machines I try things out on from time to time.  FWIW I've never had
any great difficulty getting Django stuff running on Windows.

Karen

--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread LRP

Hello,

Wow. This list is not only friendly, it parties!

Thanks to tips from Jeff Anderson, Tim Chase, and Forest Bond, I now
have start-up directories.

The trick: Debian redirects django-admin.py to django-admin. And, as
Forest Bond points out, django-admin is in a shell-executable path.

I much look forward to exploring further to see what I can learn and
accomplish.

I also appreciate Forest's additional Debian tips. There is so much to
learn, and every little bit helps. You're a winner in my book, Forest.

Hmmm, I'm wondering... I'd have little to contribute beyond my
personal blunders, but I'd be delighted to work with any folks who'd
like to prepare a Debian-specific addendum to the on-line Django
tutorial.

Thanks again all,

Lloyd




--~--~-~--~~~---~--~~
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: Error accessing "'/media" directory

2008-01-17 Thread Rodrigo Culagovski

Thanks, that did the trick!

Cheers,

Rodrigo

On Jan 17, 8:35 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Jan 17, 2008 6:24 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I am using the following in my urls.py:
>
> > (r'^media_/(?P.*)$', 'django.views.static.serve',
> > {'document_root':
> > os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),
>
> > Notice the '_' after 'media.
>
> > This allows me to access my media folder using for example:
>
> >http://127.0.0.1:8000/media_/css/css2.css
>
> > However, if i change it to:
>
> > (r'^media/(?P.*)$', 'django.views.static.serve',
> > {'document_root':
> > os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),
>
> > Notice no '_'  after 'media'.
>
> > I get the following error, trying to access 'http://127.0.0.1:8000/
> > media/css/css2.css' I get:
>
> > Page not found: C:\Python24\lib\site-packages\django/contrib/admin/
> > media\css/css2.css
>
> > So apparently when accessing 'media' it gets sent to '/contrib/admin/
> > media' instead of my media folder.
>
> When using the development server, any urls that start with the setting's
> ADMIN_MEDIA_PREFIX (which defaults to /media/) are intercepted and served up
> by the AdminMediaHandler out of the contrib/admin/media tree under the
> Django install directory.  So if you want to put you own media under urls
> that start with /media/, you need to change ADMIN_MEDIA_PREFIX to something
> else.
>
> Karen
--~--~-~--~~~---~--~~
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: Error accessing "'/media" directory

2008-01-17 Thread Karen Tracey
On Jan 17, 2008 6:24 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:

>
> I am using the following in my urls.py:
>
> (r'^media_/(?P.*)$', 'django.views.static.serve',
> {'document_root':
> os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),
>
> Notice the '_' after 'media.
>
> This allows me to access my media folder using for example:
>
> http://127.0.0.1:8000/media_/css/css2.css
>
> However, if i change it to:
>
> (r'^media/(?P.*)$', 'django.views.static.serve',
> {'document_root':
> os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),
>
> Notice no '_'  after 'media'.
>
> I get the following error, trying to access 'http://127.0.0.1:8000/
> media/css/css2.css' I get:
>
> Page not found: C:\Python24\lib\site-packages\django/contrib/admin/
> media\css/css2.css
>
> So apparently when accessing 'media' it gets sent to '/contrib/admin/
> media' instead of my media folder.
>

When using the development server, any urls that start with the setting's
ADMIN_MEDIA_PREFIX (which defaults to /media/) are intercepted and served up
by the AdminMediaHandler out of the contrib/admin/media tree under the
Django install directory.  So if you want to put you own media under urls
that start with /media/, you need to change ADMIN_MEDIA_PREFIX to something
else.

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error accessing "'/media" directory

2008-01-17 Thread Rodrigo Culagovski

I am using the following in my urls.py:

(r'^media_/(?P.*)$', 'django.views.static.serve',
{'document_root':
os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),

Notice the '_' after 'media.

This allows me to access my media folder using for example:

http://127.0.0.1:8000/media_/css/css2.css

However, if i change it to:

(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root':
os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),

Notice no '_'  after 'media'.

I get the following error, trying to access 'http://127.0.0.1:8000/
media/css/css2.css' I get:

Page not found: C:\Python24\lib\site-packages\django/contrib/admin/
media\css/css2.css

So apparently when accessing 'media' it gets sent to '/contrib/admin/
media' instead of my media folder.

I also hace this in urls.py:

(r'^admin/', include('django.contrib.admin.urls')),

thanks,

Rodrigo
--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread Forest Bond
Hi,

On Thu, Jan 17, 2008 at 10:50:50AM -0800, LRP wrote:
> django-admin.py is marked as executable, as is it's containing directory. So
> now I need to find out why it's not in the search path.  But this is probably
> a question for another forum.

Maybe a little less time writing nautical prose and a little more using the
tools Debian has blessed you with ;) :


18:16 [EMAIL PROTECTED] dpkg -L python-django | grep '/usr/bin'
/usr/bin
/usr/bin/django-admin


Not that the prose isn't cute.

Anyway, if you're going to champion the distribution, you might as well have a
few good reasons to do so.

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net


signature.asc
Description: Digital signature


Re: These waters aren't so friendly after all

2008-01-17 Thread Forest Bond
Hi,

On Thu, Jan 17, 2008 at 04:25:30PM -0600, Tim Chase wrote:
> 
> > I'm still having a problem since my shell can't seem to find django-
> > admin.py. I know it's there; found it in /usr/share/python-support/
> > python-django/django/bin.
> 
> Just to prevent other "dunder-headed mistakes", I presume it's 
> truely named "django-admin.py", not just "django-admin". :)
> 
> You might also check that 
> /usr/share/python-support/python-django/bin [aside:  this looks 
> like an odd path, but whatever floats your boat :) ]  is in your 
> system path?

Not a concern.  The .deb copies/links it to /usr/bin/django-admin .

Just type django-admin (with no .py on the end).

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net


signature.asc
Description: Digital signature


Re: Django shared hosting

2008-01-17 Thread [EMAIL PROTECTED]

Just go webfaction and save yourself a lot of pain later. They give
quite a bit of space, and if you really need insane space for media or
something, just keep a dreamhost (or whoever) account laying around.

Rodrigo Culagovski wrote:
> Can anybody recomend a shared-hosting that:
>
> a) is Django ready, with the svn-version installed or installable
>
> b) is as good or better and as cheap or cheaper then Webfaction
>
> c) gives you an insane amount of space (like Dreamhost)
>
> Basically, I need a host for a new project, and am thinking of
> Webfaction, but would like the ton of space some hosts give you.
>
> Rodrigo
--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread Tim Chase

> I'm still having a problem since my shell can't seem to find django-
> admin.py. I know it's there; found it in /usr/share/python-support/
> python-django/django/bin.

Just to prevent other "dunder-headed mistakes", I presume it's 
truely named "django-admin.py", not just "django-admin". :)

You might also check that 
/usr/share/python-support/python-django/bin [aside:  this looks 
like an odd path, but whatever floats your boat :) ]  is in your 
system path?

you should be able to either add that directory to your path, or 
create a link to it:

   ln -s 
/usr/share/python-support/python-django/bin/django-admin.py 
/usr/local/bin/django-admin.py

(all one line, in case some mail agent between here and there 
decides to break that into multiple lines)

assuming /usr/local/bin is in your system path.

> directory. So now I need to find out why it's not in the search path.
> But this is probably a question for another forum.

the easiest way is to add it to your shell's configuration file 
(usually a .bashrc or .bash_profile though I never remember which 
runs in which contexts).

   export PATH=$PATH:/usr/share/python-support/python-django/bin

> And more thanks to Jeff Anderson for helpful comments about SVN. I
> will indeed explore this further.

Yes, running from SVN has both advantages and disadvantages. 
0.96 is nice for stability (the API is pretty much frozen), but 
lacks MANY nice new features that the SVN Trunk has brought to 
the table.  However, if you follow Trunk, you have to watch the 
backwards-incompatable changes when you "svn up" to pull down the 
latest.

> Then there's Kenneth Gonzales. All I can say is, "hey dude, that's not
> very friendly."
> 
> And as for James Bennet... I can't for the life of me understand what
> he's going on about. There were no hidden traps or gotchas intended in
> my post.

The waters are full of trolls fishing for a fight about their 
favorite framework, so the sensitivity to smack it down is pretty 
high.  The list is for discussing Django, so if folks come 
looking for a fight, they're rapidly smacked down with a request 
to take up the issue on someplace like 
alt.web.frameworks.flamewar or comp.lang.ruby or some similar 
location.  Just think of it as getting unfortunately fingered as 
a false-positive.  Sorry you got mis-identified.

When not wearing defender-of-the-list hats, the ML is generally 
both friendly and helpful.

-tkc





--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django shared hosting

2008-01-17 Thread Rodrigo Culagovski

Can anybody recomend a shared-hosting that:

a) is Django ready, with the svn-version installed or installable

b) is as good or better and as cheap or cheaper then Webfaction

c) gives you an insane amount of space (like Dreamhost)

Basically, I need a host for a new project, and am thinking of
Webfaction, but would like the ton of space some hosts give you.

Rodrigo
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem in installing Django on Windows XP

2008-01-17 Thread new_to_django_install

I am quite new in Django, and trying to installing. I have the
following error when I want to run the command for installing Django:

C:\Django>setup.py install
running install
running build
running build_py
package init file '\django\__init__.py' not found (or not a regular
file)
error: package directory '\django\bin' does not exist

Can you help me on this please? I am using a PC  on Windows XP...
Thanks,
H.
--~--~-~--~~~---~--~~
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 do _you_ handle versioning your CSS/JS files?

2008-01-17 Thread Udi

In my base template:


In my ant build script:
 /*
checksum is built into ant on most os's, so it's easier than using svn
*/


  CSS_CHECKSUM





On Jan 16, 6:11 pm, Andrew <[EMAIL PROTECTED]> wrote:
> There are a bunch of articles about versioning your CSS/JS so you can
> set an infinite expires header; most of them revolve around some PHP
> code that takes either an SVN revision or unix timecode and munges the
> include header, like:
>
> 

GeoDjango: distance calculation

2008-01-17 Thread kmishler

We are starting to use geodjango (revision 7003) and are having
problems using the api to calculate distance.

class Airport(models.Model):
icao = models.CharField('ICAO', max_length=4)
location = models.PointField()

The location field will eventually be populated using lat/longs from a
text file.

For now, I populated 3 records in the table:

Airport.objects.create(icao="KBWI",
location=fromstr('POINT(-76.6683337 39.1753608)',
srid=4326))
Airport.objects.create(icao="KDEN",
location=fromstr('POINT(-104.673178 39.8616558)',
srid=4326))
Airport.objects.create(icao="EGLL",
location=fromstr('POINT(-0.46138889 51.4774999)',
srid=4326))

When I try to use the api to get distance, I do not get the correct
results:

point = Airport.objects.get(icao="KBWI").location
for airport in Airport.objects.distance(point):
print airport.icao + ": " + str(airport.distance) + ", " +
str(Distance(degree=airport.distance).nm)

EGLL: 77.1935295397, 0.000727473678024
KBWI: 0.0, 0.0
KDEN: 28.0132524428, 0.000263997564426

select icao, ST_distance(ST_GeomFromText('POINT(-76.6683337
39.1753608)',4326), location) from common_airport;
 icao |   st_distance
--+--
 KBWI |0
 KDEN | 28.0132524427637
 EGLL | 77.1935295397234


select icao,
distance_sphere(ST_GeomFromText('POINT(-76.6683337
39.1753608)',4326), location) from common_airport;
 icao |   distance_sphereconverting manually to nm
--+--
 KDEN |  2393555.0105449 1292.41631
 KBWI | 2.81660258041303e-10 0
 EGLL | 5833168.46744864 3149.65875


Using distance_sphere, I get the correct results.  Is there any way to
use the django api to get distance_sphere?

I also tried using the SRID 32140:

class Airport(models.Model):
icao = models.CharField('ICAO', max_length=4)
location = models.PointField(32140)

I used the same code to populate the records - it's nice that
geodjango can do that.

When I try to use the api to get distance, I get closer results, but
they're still not correct:

point = Airport.objects.get(icao="KBWI").location
for airport in Airport.objects.distance(point):
print airport.icao + ": " + str(airport.distance) + ", " +
str(Distance(meter=airport.distance).nm)

EGLL: 6258767.81814, 3379.46426466
KBWI: 0.0, 0.0
KDEN: 2442966.58517, 1319.09642828

Is there any way to use the django api to get the distance?


Versions:
 WhiteBox Enterprise Linux 3.0 (clone of Red Hat enterprise 3.0)
 gcc 3.2.3 / glibc 3.2.3
 Python 2.4.2
 ctypes 1.0.2
 PostgreSQL 8.2.4
 postgis 1.3.2
 geos 3.0.0
 proj4 4.6.0
 curl 7.17.1 (needed for gdal)
 expat 2.0.1 (needed for gdal)
 gdal 1.5.0

--~--~-~--~~~---~--~~
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 Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread code_berzerker


> So, though the settings.py you posted has TEMPLATE_DIRS with your '/
> var/www...'directory listed, the one you are running with has no
> TEMPLATE_DIRS.

Yes I've noticed that, but I use settings.py listed above. Django uses
db configuration from that file and other things too. Somehow
TEMPLATE_DIRS gets cleared or filtered. for example if I run python
manage.py shell from project dir and inspect settings module it is
empty. I'm kinda new to Python and Django, so I may actually do some
stupid mistake on the way. I'm getting frustrated enough to convinve
myself to use pdb to run that code step by step. I dont know how to
use pdb and it scares me yet Still considering installing Django
on windows and trying to debug it through Eric or SPE (but since winxp
is different platform I can get different issues and that holds me off
it).

BTW if it does matter I've setup Ubuntu (just shell, no X-Windows) on
VMWare and using it as development server from windows xp.

--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]

Yeah, that's the one I have. Like I said, everything works, 'cept
manage.py. I can get by without it, but it'd be nice to have the sql
functions and syncdb.

On Jan 17, 12:57 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hmm, that was the only obvious thought that I had.  Just to make
> sure...you know that the _parent_ directory to "shared" is really the
> one that you want to be on your Python path, correct?
>
> On Jan 17, 12:38 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > On Jan 17, 12:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > Try creating a blank file named __init__.py in the directory named
> > > "shared".  That way, Python knows that it's a module.
>
> > Thanks floguy, but I've done that already. I see that it's compiled,
> > too. As near as I can tell, python knows it's a module, and I'm using
> > the shared code, but manage.py is freaking out.
--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]

Hmm, that was the only obvious thought that I had.  Just to make
sure...you know that the _parent_ directory to "shared" is really the
one that you want to be on your Python path, correct?

On Jan 17, 12:38 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> On Jan 17, 12:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > Try creating a blank file named __init__.py in the directory named
> > "shared".  That way, Python knows that it's a module.
>
> Thanks floguy, but I've done that already. I see that it's compiled,
> too. As near as I can tell, python knows it's a module, and I'm using
> the shared code, but manage.py is freaking out.
--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread LRP

Hello,

Many many thanks for the thoughtful corrections and comments.

Particularly...

Karen Tracey for pointing out my dunder- headed mistake in running
django-admin.py from Python rather than shell command line.

I'm still having a problem since my shell can't seem to find django-
admin.py. I know it's there; found it in /usr/share/python-support/
python-django/django/bin.

django-admin.py is marked as executable, as is it's containing
directory. So now I need to find out why it's not in the search path.
But this is probably a question for another forum.

And more thanks to Jeff Anderson for helpful comments about SVN. I
will indeed explore this further.

And to Michael for a deeply thoughtful comparison of Python web
frameworks. I much appreciate the time and consideration invested in
this reply.

Then there's Kenneth Gonzales. All I can say is, "hey dude, that's not
very friendly."

And as for James Bennet... I can't for the life of me understand what
he's going on about. There were no hidden traps or gotchas intended in
my post.

I very much like what I've read about django. Unfortunately, my first
two attempts to bring it up have been disappointing. So I did exactly
what the tutorial suggested, turned to the experts on django-users.

I welcome correction if I am doing something incorrectly, or even
stupidly. But if there are barriers to adoption by newbies, isn't this
something the community should be aware of?

If my attempt at levity in the midst of a very frustrating situation
offends some, my apologies.

To all... Many thanks again.

Lloyd



--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]


On Jan 17, 12:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Try creating a blank file named __init__.py in the directory named
> "shared".  That way, Python knows that it's a module.
>

Thanks floguy, but I've done that already. I see that it's compiled,
too. As near as I can tell, python knows it's a module, and I'm using
the shared code, but manage.py is freaking out.
--~--~-~--~~~---~--~~
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: Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]

Try creating a blank file named __init__.py in the directory named
"shared".  That way, Python knows that it's a module.

On Jan 17, 11:30 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I asked this before, but I think it got lost in another issue. For
> those who've already seen it, I apologize for being repetitive.
>
> What I'm trying to do is have a setup like:
>
> project1/
> project2/
> shared/
>
> With shared holding a bunch of apps both project 1 and project 2 are
> using. I've got the projects seeing the apps in shared, and everything
> seems to be working fine, except when I try to use manage.py, I'm
> hosed. I get ImportError: No module named shared
>
> I'm sure Shared is on the pythonpath, and like I said, the other
> projects are able to import from it and use it with no problem. It's
> manage.py that won't cooperate with this. Suggestions?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with manage.py and shared app/project structure

2008-01-17 Thread [EMAIL PROTECTED]

I asked this before, but I think it got lost in another issue. For
those who've already seen it, I apologize for being repetitive.

What I'm trying to do is have a setup like:

project1/
project2/
shared/

With shared holding a bunch of apps both project 1 and project 2 are
using. I've got the projects seeing the apps in shared, and everything
seems to be working fine, except when I try to use manage.py, I'm
hosed. I get ImportError: No module named shared

I'm sure Shared is on the pythonpath, and like I said, the other
projects are able to import from it and use it with no problem. It's
manage.py that won't cooperate with this. Suggestions?




--~--~-~--~~~---~--~~
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: open flash chart & django

2008-01-17 Thread [EMAIL PROTECTED]

I'm embarrassed to admit I can't remember exactly which flash charting
solution I went with, but I believe it was XML/SWF:
http://www.maani.us/xml_charts/index.php?menu=Introduction

You can see it here: 
http://classicmotorsports.net/project-cars/1970-datsun-240z/
Scroll down to "on the dyno", then click on the Aug. dyno run.

Using it is pretty simple. All the flash stuff is in my media folder.
Object tag in the page template looks like this:



   

You'll note it calls dyno_run.xml
the path to that is defined in my urls.py so as far as Flash is
concerned, it's a relative url to the page calling it
(r'^project-cars/(?P(\w|-)+)/dyno-runs/(?P\d+)/$',
'classic.projects.views.get_dyno_runs'),

In views, I'm just gathering up whatever data I want to plot, so I
won't bore you with that.

Then, the dyno_run.xml is pretty straightforward:





line





{% for item in run_values_list 
%}{{item.rpm}}{%
endfor %}


Horsepower
{% for item in run_values_list %}{{item.hp}}{% endfor %}


Torque
{% for item in run_values_list %}{{item.torque}}{% endfor %}





On Jan 17, 9:20 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> I've been considering this, but haven't gotten around to actually
> doing so. Keep us posted if you have any success.
>
> -Gul
--~--~-~--~~~---~--~~
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 get list value of cursor.fetchall() in template

2008-01-17 Thread Karen Tracey

On Jan 17, 12:10 pm, Nader <[EMAIL PROTECTED]> wrote:
> Hallo
>
> For a reason I had to customize the Manager class of a model:
>
> class QueueManager(models.Manager):
> def usedInputs(self, id):
> from django.db import connection
> cursor = connection.cursor()
> cursor.execute("""
>SELECT * FROM usedInput WHERE jobID=%s""" % id)
> result_list = []
> for row in cursor.fetchall():
> result_list.append(row)
> return result_list
>
> This function returns a list of tuples. The I define a view function:
>
> def inputs(request, id):
> q_list = Usedinput.objects.usedInputs(id)
> return render_to_response(
> 'usedInputs/inputs.html', {'q_list': q_list}
>
> And in a template I woud present the list elements in a table:
>
> {% if q_list %}
>  
>
>  jobID
>  processorID
>  datasetID
>  filename
>  fileVersion
>
>
>{% for input in q_list %}
>  
>   {{ input[0][0] }}
>   {{ input[0][1] }}
>   {{ input[0][2] }}
>   {{ input[0][3] }}
>   {{ input[0][4] }}
>  
>{% endfor %}
>  
> {% endif %}
>
> But in template we could not present the value as "input[0][0]". Would
> somebody give me a solution of this problem?
>

Make the row-creation part of your table:

{% for input in q_list %}
{% for elem in input %}{{ elem }}{% endfor %}
{% endfor %}

Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How get list value of cursor.fetchall() in template

2008-01-17 Thread Nader

Hallo

For a reason I had to customize the Manager class of a model:

class QueueManager(models.Manager):
def usedInputs(self, id):
from django.db import connection
cursor = connection.cursor()
cursor.execute("""
   SELECT * FROM usedInput WHERE jobID=%s""" % id)
result_list = []
for row in cursor.fetchall():
result_list.append(row)
return result_list

This function returns a list of tuples. The I define a view function:

def inputs(request, id):
q_list = Usedinput.objects.usedInputs(id)
return render_to_response(
'usedInputs/inputs.html', {'q_list': q_list}

And in a template I woud present the list elements in a table:

{% if q_list %}
 
   
 jobID
 processorID
 datasetID
 filename
 fileVersion
   
   
   {% for input in q_list %}
 
  {{ input[0][0] }}
  {{ input[0][1] }}
  {{ input[0][2] }}
  {{ input[0][3] }}
  {{ input[0][4] }}
 
   {% endfor %}
 
{% endif %}

But in template we could not present the value as "input[0][0]". Would
somebody give me a solution of this problem?

Regards,
Nader
--~--~-~--~~~---~--~~
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 Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread Karen Tracey

Somehow you are not using the version of the settings.py file you
think you are.  See below.

On Jan 17, 11:26 am, code_berzerker <[EMAIL PROTECTED]> wrote:
> Trying to solve the problem I added following code to settings.py:
>
> ALLOWED_INCLUDE_ROOTS = (
> '/var/www',
> )
>

Just FYI, as far as I know, this setting is only used for the ssi
tag.  The tutorial doesn't use that, does it?  So I don't believe this
is needed.

[much snipped]

> Settings
> Using settings module mysite.settings
> Setting Value

[more snipped]

> TEMPLATE_DIRS
> ()

[more snipped]

>
> **
> * settings.py: *
> **
>
>
> TEMPLATE_DIRS = (
> # Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> '/var/www/test/djtest/tpl',
> #"/home/html/djtest/tpl",
> )
>

So, though the settings.py you posted has TEMPLATE_DIRS with your '/
var/www...' directory listed, the one you are running with has no
TEMPLATE_DIRS.

Karen
--~--~-~--~~~---~--~~
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: Templates with multiple repeating blocks

2008-01-17 Thread AmanKow


On Jan 16, 3:41 am, stryderjzw <[EMAIL PROTECTED]> wrote:
> Thanks, everyone.
>
> I like this idea.  That really helped. I hope this gets considered.
>
> Cheers,
> Justin

Ok, as soon as I get a chance, I'll get some docs and tests done and
post a ticket with a patch.  That should greatly improve the chance of
it getting in.


I also find it incredibly useful to reuse a block.  It comes up very
often, especially with the title tag in the header and then wanting
the title tag content again in a h? tag in the body.  Also comes up a
lot with lists of links that need presentation in the header and
footer of a page.  Much DRYer than cutting and pasting the info over
and over.

On that note, I was thinking that 'block_ref' might be a better name
than 'reuse_block'.  Also, I was wondering if it might not be a good
idea to have a block cache it's rendering on first render when a block
has references.  Wouldn't be that hard, would ensure that expensive
blocks were rendered once, and that the two renderings were identical
should any of the dynamic content change between renderings.

Thoughts?
Wayne
--~--~-~--~~~---~--~~
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 Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread code_berzerker

Trying to solve the problem I added following code to settings.py:

ALLOWED_INCLUDE_ROOTS = (
'/var/www',
)

but it didnt help.

I skipped this error for a bit and continued with tutorial and heres
backtrace of what happened later and also my settings.py content.

**
*  backtrace:  *
**

TemplateDoesNotExist at /test/djtest/polls/
polls/index.html
Request Method: GET
Request URL:http://192.168.233.129:8080/test/djtest/polls/
Exception Type: TemplateDoesNotExist
Exception Value:polls/index.html
Exception Location: /usr/lib/python2.5/site-packages/django/template/
loader.py in find_template_source, line 72
Python Executable:  /usr/bin/python
Python Version: 2.5.1
Python Path:['/var/www/test/djtest/mysite', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/
python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/
python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/
lib/python2.5/site-packages/Numeric', '/var/lib/python-support/
python2.5']
Template-loader postmortem

Django tried loading these templates, in this order:

* Using loader
django.template.loaders.filesystem.load_template_source:
* Using loader
django.template.loaders.app_directories.load_template_source:
  o /usr/lib/python2.5/site-packages/django/contrib/admin/
templates/polls/index.html (File does not exist)

Traceback Switch to copy-and-paste view

* /usr/lib/python2.5/site-packages/django/core/handlers/base.py in
get_response
75. # Apply view middleware
76. for middleware_method in self._view_middleware:
77. response = middleware_method(request, callback,
callback_args, callback_kwargs)
78. if response:
79. return response
80.
81. try:
82. response = callback(request, *callback_args,
**callback_kwargs) ...
83. except Exception, e:
84. # If the view raised an exception, run it through
exception
85. # middleware, and if the exception middleware returns a
86. # response, use that. Otherwise, reraise the exception.
87. for middleware_method in self._exception_middleware:
88. response = middleware_method(request, e)
  ▼ Local vars
  Variable  Value
  callback
  
  callback_args
  ()
  callback_kwargs
  {}
  debug
  
  e
  TemplateDoesNotExist('polls/index.html',)
  exceptions
  
  mail_admins
  
  middleware_method
  >
  request
  , POST:, COOKIES:
{'sessionid': '54170faf598f4c6a41c2be99843f5d7c'}, META:
{'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain',
'DJANGO_SETTINGS_MODULE': 'mysite.settings', 'GATEWAY_INTERFACE': 'CGI/
1.1', 'HISTCONTROL': 'ignoreboth', 'HOME': '/home/notroot',
'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-
us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION':
'keep-alive', 'HTTP_COOKIE':
'sessionid=54170faf598f4c6a41c2be99843f5d7c', 'HTTP_HOST':
'192.168.233.129:8080', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT':
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/
20071127 Firefox/2.0.0.11', 'HUSHLOGIN': 'FALSE', 'LANG':
'en_US.UTF-8', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'LESSOPEN': '| /
usr/bin/lesspipe %s', 'LOGNAME': 'notroot', 'LS_COLORS':
'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:',
'MAIL': '/var/mail/notroot', 'OLDPWD': '/var/www/test/djtest', 'PATH':
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/
games', 'PATH_INFO': '/test/djtest/polls/', 'PWD': '/var/www/test/
djtest/mysite', 'QUERY_STRING': '', 'REMOTE_ADDR': '192.168.233.1',
'REMOTE_HOST': '', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true',
'SCRIPT_NAME': '', 'SERVER_NAME': 'ubuntu.localdomain', 'SERVER_PORT':
'8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/
0.1 Python/2.5.1', 'SHELL': '/bin/bash', 'SHLVL': '1', 'TERM':
'linux', 'TZ': 'Europe/Warsaw', 'USER': 'notroot', '_': '/usr/bin/
python', 'wsgi.errors': ', mode 'w' at
0xb7d4e0b0>, 'wsgi.file_wrapper': , 'wsgi.input':
, 'wsgi.multiprocess': False,
'wsgi.multithread': 

Re: how to pass dynamic number of not named args to the view?

2008-01-17 Thread sector119

it's smart, readable urls and lite regexp :) thanks :)

On 17 Січ, 16:52, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> On Jan 17, 2008 7:19 AM, sector119 <[EMAIL PROTECTED]> wrote:
>
> > I decide to create delete_many view and I want to pass dynamic number
> > of args to it using urls:
>
> > /streets/street/1/delete/
> > /streets/street/12/3/4/delete/
> > /streets/street/7/12/43/98/192/delete/
>
> > what regexp in urls.py an view definition have I to use in my
> > situation?
>
> > view definition, I think, have to be something like:
> > def delete_many(request, *args, **kwargs):
> >     ...
>
> > but how to write url regexp?
>
> I'd recommend something like this for your regex:
>
> ^streets/street/(?P(?:[0-9]+/?)*)/delete/
>
> That will pull in all the numbers as a single string, since you can't
> have an arbitrary number of groups in regular expressions. In your
> view, you just split them apart, like so:
>
> def view(request, id_list):
>     id_list = map(int, id_list.split('/'))
>     # You now have a list of IDs passed to the view
>
> Hope that helps.
>
> -Gul
--~--~-~--~~~---~--~~
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: open flash chart & django

2008-01-17 Thread Marty Alchin

I've been considering this, but haven't gotten around to actually
doing so. Keep us posted if you have any success.

-Gul

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



open flash chart & django

2008-01-17 Thread patrickk

has anybody succesfully used "open flash chart" with django?
i´ve been downloading the files and installed it, but the (flash)data
isn´t displayed.

questions are:
- where do you put the files? guess OpenFlashChart.py should be
somewhere on the PYTHONPATH whereas the .swf and .js-files are in the
media-folder.
- how do you actually render data? what does the view look like?

thanks,
patrick
--~--~-~--~~~---~--~~
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 pass dynamic number of not named args to the view?

2008-01-17 Thread Marty Alchin

On Jan 17, 2008 7:19 AM, sector119 <[EMAIL PROTECTED]> wrote:
> I decide to create delete_many view and I want to pass dynamic number
> of args to it using urls:
>
> /streets/street/1/delete/
> /streets/street/12/3/4/delete/
> /streets/street/7/12/43/98/192/delete/
>
> what regexp in urls.py an view definition have I to use in my
> situation?
>
> view definition, I think, have to be something like:
> def delete_many(request, *args, **kwargs):
> ...
>
> but how to write url regexp?

I'd recommend something like this for your regex:

^streets/street/(?P(?:[0-9]+/?)*)/delete/

That will pull in all the numbers as a single string, since you can't
have an arbitrary number of groups in regular expressions. In your
view, you just split them apart, like so:

def view(request, id_list):
id_list = map(int, id_list.split('/'))
# You now have a list of IDs passed to the view

Hope that helps.

-Gul

--~--~-~--~~~---~--~~
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: about dpaste

2008-01-17 Thread Simon Rivada

As far as I know there is no search engine present at dpaste.com.

Lic. José M. Rodriguez Bacallao wrote:
> Hi folks, I need to know how can I search, explore for codes in
> http://dpaste.com/
> I really can't figure out how.
>
>   

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



about dpaste

2008-01-17 Thread Lic. José M. Rodriguez Bacallao
Hi folks, I need to know how can I search, explore for codes in
http://dpaste.com/
I really can't figure out how.

-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

--~--~-~--~~~---~--~~
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: Unable to find custom filters

2008-01-17 Thread Rajesh Dhawan



On Jan 16, 11:30 pm, Collin Grady <[EMAIL PROTECTED]> wrote:
> He did add it - 'test2.test'

I don't think so. If you look at the original post, the custom filters
file is in the app called 'app'. Taking that into account he would
need to add something like 'test2.app'.

--~--~-~--~~~---~--~~
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: I think the django's froms js too complicated and not flexible , is there anybody agree?

2008-01-17 Thread James Bennett

On Jan 17, 2008 6:30 AM, maoxl <[EMAIL PROTECTED]> wrote:
> writing a html form is just NOT so complicated, and I really don't
> think it deserve a py package as luxury  as the
> django.contrib.newfroms . why not just write html forms by hand .
> I'm a new comer to django, hoping somebody tell me the philosophy
> behind the design of newforms

The purpose of the newforms package is to make it easy to to
server-side validation of submitted data. The fact that it also does a
good job of spitting out HTML is a nice bonus.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: I think the django's froms js too complicated and not flexible , is there anybody agree?

2008-01-17 Thread Grindizer

Writing a html form is a very repetitive task: design a form (generaly
taken from some db field), prepare the html, render it, get the
result, validate it, and save it to db.
newforms lib gathers all what this tasks have in commun (and some
times more) and i'am really convinced that it is far to be a luxury.

In addition to this, newforms is not imposed, peaple who find simple
to manage process of creating htmlform themselves, are still free to
do it.

On 17 jan, 13:30, maoxl <[EMAIL PROTECTED]> wrote:
> writing a html form is just NOT so complicated, and I really don't
> think it deserve a py package as luxury  as the
> django.contrib.newfroms . why not just write html forms by hand .
> I'm a new comer to django, hoping somebody tell me the philosophy
> behind the design of newforms
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



about dbpaste

2008-01-17 Thread Lic. José M. Rodriguez Bacallao
Hi folks, I need to know how can I search, explore for codes in
http://dpaste.com/
I really can't figure out how.

-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

--~--~-~--~~~---~--~~
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: Problem with loading fixture xml to Postgres database

2008-01-17 Thread knight

I'm not sure, but I think it's a problem with the psycopg backend
under Python 2.3.5.
When I loaded fixtures with Python 2.3.5 I got no errors and the
fixtures haven't been loaded.
When I loaded fixtures with Python 2.5 I got an error and when I fixed
it the fixtures were loaded.
I used the same fixtures data.
I'm sorry, but I don't have Python 2.3.5 environment anymore, so I can
not check it.

Regards, Alex Arshavski.

On Jan 17, 12:42 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Jan 16, 2008 10:47 PM, knight <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have figured out what theproblemis.
> > I was using python 2.3.5. And with this python version, Django says
> > that X entities were imported, but none is really imported.
> > And after installing python 2.5, I got the error message on missing
> > dependencies.
>
> This is interesting - I wasn't aware of any differences that might
> exist with the Python 2.3.5 backend.
>
> Is this aproblemwith the psycopg backend under Python 2.3.5? Does it
> undergo dependency failures in a different way to the Python 2.5
> backend?
>
> If you run the Django system tests (the runtests.py script in the test
> directory of a Django checkout) using Python 2.3.5, do you get any
> failures?
>
> 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-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
-~--~~~~--~~--~--~---



I think the django's froms js too complicated and not flexible , is there anybody agree?

2008-01-17 Thread maoxl

writing a html form is just NOT so complicated, and I really don't
think it deserve a py package as luxury  as the
django.contrib.newfroms . why not just write html forms by hand .
I'm a new comer to django, hoping somebody tell me the philosophy
behind the design of newforms

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to pass dynamic number of not named args to the view?

2008-01-17 Thread sector119

I decide to create delete_many view and I want to pass dynamic number
of args to it using urls:

/streets/street/1/delete/
/streets/street/12/3/4/delete/
/streets/street/7/12/43/98/192/delete/

what regexp in urls.py an view definition have I to use in my
situation?

view definition, I think, have to be something like:
def delete_many(request, *args, **kwargs):
...

but how to write url regexp?
--~--~-~--~~~---~--~~
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: Private (owner) vs. public records

2008-01-17 Thread Tim Chase

> I fully agree with you. This is generaly not a very good
> design, but i think we can do some exception for a very
> specific problems. For example, i found this very handy, when
> we have to support a multilingual db: getting the current
> language like this and use it to select the right values in db
> can save us a lot of work, and result in a more clear views
> code and template.

Bugged by the thread-local storage of the user, I've used a
classmethod to return the allowed objects, something like:

  def MyModel(Model):
owner = ForeignKey(User)
public = BooleanField()
def for_user(cls, user):
  return cls.objects.filter(
Q(owner__id = user.id) |
Q(public=True)
)
for_user = classmethod(for_user)

and then in my view's code, simply use

  things = MyModel.for_user(request.user)

I'd like to try stunt I saw recently where I've got a decorative
model in the inheritance hierarchy that allows me to just define
standard field-names and then use multiple-inheritance to bring
in the method:

  class FilteredByUser(object):
def for_user(cls, user):
  filters = Q(owner__id=user.id)
  if hasattr(cls, 'public'): #not sure on this syntax
filters |= Q(public=True)
  return cls.objects.filter(filters)
for_user = classmethod(for_user)

  def MyModel1(Model, FilteredByUser):
owner = ForeignKey(User)
public = BooleanField()

  def MyModel2(Model, FilteredByUser):
owner = ForeignKey(User)

Tricky use of the Meta class might even be an elegant way to do
this without forcing the field-names to be "owner" and "public",
possibly allowing for definition of something like

  def MyModel3(Model, FilteredByUser):
author = ForeignKey(User)
published = BooleanField()
class Meta:
  userfield = 'author'
  publicfield = 'published'

but patching FilteredByUser to allow for smart use of the Meta
class is left as an exercise for the reader (or at least until I
have some time to sit down and hack it :)

[regarding using thread-local variables to store the user]
> I know that it is not very good, but it is like evil, it is
> tempting :-)

+1 QOTW :)

-tkc




--~--~-~--~~~---~--~~
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: Private (owner) vs. public records

2008-01-17 Thread James Bennett

On Jan 17, 2008 5:36 AM, Grindizer <[EMAIL PROTECTED]> wrote:
> For example, i found this very handy, when we have to support a
> multilingual db: getting the current language like this and use it to
> select the right values in db can save us a lot of work, and result in
> a more clear views code and template.

You want to have a look in django.utils.translation, which already has
code to manage things like getting/setting the active language.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Private (owner) vs. public records

2008-01-17 Thread Grindizer

I fully agree with you. This is generaly not a very good design, but i
think we can do some exception for a very specific problems.
For example, i found this very handy, when we have to support a
multilingual db: getting the current language like this and use it to
select the right values in db can save us a lot of work, and result in
a more clear views code and template.

I know that it is not very good, but it is like evil, it is
tempting :-)


On 17 jan, 12:07, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Jan 17, 2008 5:00 AM, Grindizer <[EMAIL PROTECTED]> wrote:
>
> > - If you want to retrieve the current logged user at model level, this
> > is a little more complicated, because models are note designed to see
> > what happen at process level, but it still possible, look at this:
>
> Any code which requires this is, in my opinion, badly designed and
> should be re-thought so that it accesses the user object from a
> context where it's already naturally available -- preferably in a view
> which has access to the HttpRequest object. It's easy enough to pass
> the request, or the logged-in user read from the request, to functions
> on an as-needed basis, and doing so is much clearer and much less
> hackish than the threadlocals trick.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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: Internationalization

2008-01-17 Thread Artiom Diomin

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

By the way, I've noticed that template tag {% edit_translation %} in
this project assumes oldforms

Alex Koshelev пишет:
| http://code.google.com/p/django-multilingual/
| Helps you to have translations for database entries
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHjznMHoZOXY8LFOARAlkWAJ4jF20MeHfLES0WhmQ8UFzdAS7JkQCdE0J6
9Zo04meC8WrkxdEj0y7hu/M=
=4vxW
-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread code_berzerker

On Jan 17, 5:33 am, Collin Grady <[EMAIL PROTECTED]> wrote:
> On Jan 16, 11:22 am, code_berzerker <[EMAIL PROTECTED]> wrote:
>
> > I put my templates somewhere in /var/www/ just beside project code and
> > media files.
>
> If /var/www is a web root, your project code should *not* be there.
> Don't ever put django code in a web-readable directory if you can help
> it :)

Thanx, I will use your advice when I put django app on production
server :)
--~--~-~--~~~---~--~~
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 Tutorial02 / TEMPLATE_DIRS

2008-01-17 Thread code_berzerker

On Jan 16, 8:36 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> 1. settings.TEMPLATE_LOADERS contains the entry
> django.template.loaders.filesystem.load_template_source before the
> entry django.template.loaders.app_directories.load_template_source

the order is correct

> 2. the path specified in TEMPLATE_DIRS has no typos

path is verified via commandline (cd /path/to/tpl/) and was correct

> 3. the user you are running the Django application as has read/write
> access to that template directory. Are you using the built-in
> development server (python manage.py runserver) or an external web
> server (Apache)? If it's the latter, you will need to make sure that
> the user that Apache runs as has access to that template directory.

I use devserver and even setting 777 on the directory tree for
templates doesnt help.
--~--~-~--~~~---~--~~
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: Private (owner) vs. public records

2008-01-17 Thread James Bennett

On Jan 17, 2008 5:00 AM, Grindizer <[EMAIL PROTECTED]> wrote:
> - If you want to retrieve the current logged user at model level, this
> is a little more complicated, because models are note designed to see
> what happen at process level, but it still possible, look at this:

Any code which requires this is, in my opinion, badly designed and
should be re-thought so that it accesses the user object from a
context where it's already naturally available -- preferably in a view
which has access to the HttpRequest object. It's easy enough to pass
the request, or the logged-in user read from the request, to functions
on an as-needed basis, and doing so is much clearer and much less
hackish than the threadlocals trick.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Private (owner) vs. public records

2008-01-17 Thread Grindizer

- If you want retrieve all Person objects that can be viewed by a
user, this is possible with this query:

persons = Person.objects.filter( Q(owner=my_user) | Q(public=True) )

my_user is the current logged user, so this query, in designed to be
executed in a view function.

- If you want to retrieve the current logged user at model level, this
is a little more complicated, because models are note designed to see
what happen at process level, but it still possible, look at this:
http://lukeplant.me.uk/blog.php?id=1107301634


So you can finally write a custom manager in which you will have
something like this:

my_user = get_current_user()
Person.objects.filter( Q(owner= my_user ) | Q(public=True) )


On 17 jan, 03:18, John M <[EMAIL PROTECTED]> wrote:
> I want to create a model system where a user can own a record (i.e.
> foreign key to users table) and those records are only seen by that
> user OR the user can choose to make the record public (boolean field
> in model) that allows others to view-only the record.
>
> I was trying to come up with some simple model managers to do this,
> but wanted to get some input first.
>
> a Model something like:
>
> class Person(models.Model):
> first_name = models.CharField(max_length=30)
> last_name = models.CharField(max_length=30)
> owner = models.ForeignKey(user)
> public = models.booleanfield()
>
> Basically, this will be a site where users can keep track of their
> stuff, but allow others to view what they have too (the person model
> isn't what I'm going to use, just an example).
>
> Any thoughts?
>
> Thanks
--~--~-~--~~~---~--~~
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 multi application, multi database, need to sync..

2008-01-17 Thread Ivan Illarionov

On 17 янв, 05:58, otonk <[EMAIL PROTECTED]> wrote:
> hi, i am currently designing two or more django application, one
> application act as the master application, contains all the data, the
> other application has partial function of the master application. The
> master database belongs to the master application, other database has
> a partial data from the master database. The reason we have such
> design is these application is separated geographically and the
> connection may not be always available. The problem with this design
> is how to move partial data from master db to other db, the sync
> process is triggered by user. I need an way to sync the data. I know
> this is doable but I am confused with the implementation. Any solution
> is appreciated. Thank you.

Create the sync script using the Python DB API directly (no Django
ORM). And then trigger it either automatically with the cron job or
manually, by wrapping that script inside django view. You may want to
add `modified` DateTimeField to all your Django models and store the
last sync date/time somewhere. So the sync script should only SELECT
records from master database where 'modified' is greater than last
sync date and INSERT/UPDATE it into other 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
-~--~~~~--~~--~--~---



And now there is something better than GOOGLE

2008-01-17 Thread [EMAIL PROTECTED]

Its a new revolution in finding inormation on the internet

I used this to get most of my info on F1 and fooball

Check out http://askhomer.co.nr/
--~--~-~--~~~---~--~~
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: Loading Template

2008-01-17 Thread laspal

Ok thanks got it.

On Jan 17, 1:20 pm, shabda <[EMAIL PROTECTED]> wrote:
> Save yourself the trouble of writing a view function and use the
> generic view 
> direct_to_templatehttp://www.djangoproject.com/documentation/generic_views/#django-view...
>
> On Jan 17, 12:50 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Jan 17, 2008 2:32 AM, laspal <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
> > > I wanted to know how can I load template without adding any
> > > functionality to it.
> > > Basically I just wanted to see how does my template looks.
>
> > > MY view.py is :
> > > from django.template.loader import get_template
> > > from django.template import Context
>
> > > def Main_Page(request):
> > >t = get_template('MainPage.html')
> > >html = t.render(Context({}))
> > >   ???
> > >???
>
> > html = t.render(Context({}))
> > return HttpResponse(html)
>
> > That will render the template with an empty context and return the result.
> > This will only work  if your template in fact does not need any context
> > variables to render properly.
>
> > Karen
--~--~-~--~~~---~--~~
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: These waters aren't so friendly after all

2008-01-17 Thread michael

>
> ...well, the local folks are friendly enough.
>
> Last I washed upon these sands, capsized on the first leg of my maiden
> voyage, I was advised that my vessel, django 0.95.1-1, running on
> Linux Debian Etch, was a relic beyond salvage.
>
> So back in port, I smash a magnum of champagne across the bow of my
> sleek new django 0.96-1.1, running on Linux Debian Lenny, and cheer as
> she slides down the weighs.
>
> I fire up Python (2.4.4), import django, and enter django.VERSION...
> oops? What's this 0.96.0994? Supposed to be 0.96.1-1.
>
> Well let's try django-admin.py startproject mysite... Whooo ABANDON
> SHIP! SyntaxError: invalid syntax.
>
> So here I am again... stranded on the sand.
>
> Ok, ok... I know you Windows salts have no sympathy for we who choose
> Linux. More's the pity. And we who choose Debian are a still smaller
> minority. But, damnit, hold the flame war, in my experience, Debian
> has the best package management system on the globe. It let's us
> choose stable, testing, and unstable versions of our applications. In
> my case, I value stability in my web applications. But 'pears to me
> that django doesn't offer that, at least for my crowd.
>
> Indeed, during my previous visit to these climes, one bystander urged
> me to download the SVN version of django for the latest and the
> greatest. But this advice scares the socks off me. How can I promise
> my clients stability when I'm gamboling on the cutting edge? Moreover,
> it makes me nervous as heck to consider compromising my file system
> with apt-alien files, when apt and aptitude have served me so well
> over these five years. Indeed, I've never run into the kinds of
> problems of starting up a new application that I've seen with django.
>
> So where do I turn? Pylons? TurboGears? Ruby on Rails? Wait until
> django stabilizes sufficiently for conservative folks like me?
>
> Advisories welcomed.
>
> All the best,
>
> Lloyd
> >
>
H,

I have that very same version running without syntax errors on Goobuntu,
with all the apts you'd care to get.  To be honest, I downloaded the
tarball, unpacked it and used the Python package management system to
install, which goes something like this:

tar xvzf django-0.96.tar.gz
cd django-0.96
sudo python setup.py install

and voila`...

There is nothing terribly unstable about the bleeding edge of django.  In
many ways, you can expect the SVN version to be most complete as they use
an agile development system and the SVN stuff is a real release.  Python
in use is version 2.43.

I have also had success with django on Mandriva 2008 (with Python 2.51).

A word to the wise... if you want django on windows with that boneheaded
IIS version 6.0 or later, you need version 0.95 with PyISAPIe as an
accessory.

TurboGears would be a terrible choice.  Python does not do well on threads
and has been known to lock up solid when executing a fork() out of a
thread.  Also, unless you feel your webserver should use very little of
your computers resources, the threaded approach of TurboGears may not give
you what you want.  Python folk made a design decision way back to
implement a Global Interpreter Lock that means one thread runs at a time
in any process, even if you have 100 threads and 32 processor cores, one
thread will be running on one processor.  So while TurboGears has a very
short learning curve, it is not really for production performance.

Zope might be the ticket for you if you don't have patience for Django. 
The Zope Enterprise Objects running as parallel processes do provide high
performance.  Most people who have used it call ZEO the bee's knees.  Zope
will work with its own production server, or with apache, or IIS up
through 5.0, or even boa.  Zope will work with most databases, and it it
also has its own, called ZODB, and the O is for Object.  The granularity
of the security is unsurpassed, and the support community is large.  Given
all that, for the particular job Django was designed for, nothing can
touch it.

Now, if you care to fall down one level, there are two frameworks of
significance.  SqlAlchemy and Formalchemy.  I have a program which takes
two  command-line parameters and imports Sqlalchemy.  One of the
command-line parameters is the url for the data base, and the other is the
path to a csv (comma separated variable) file.  The program probes the url
to determine which database it is talking to, then looks at the csv,
taking the first row as column names.  Going down the columns, it guesses
the type, then it creates the table and loads it with the data from the
csv.  That program is nothing special, everyone would say, I am sure, but
it becomes special when you discover that it does these things in 98 lines
of code.

So you have:

TurboGears (Threads limits the performance)
Django (Best for web-publishing applications and pretty good at most other
things)
Zope (lots of options, production performance, and huge)
Plone (Content Management on top of Zope)
and then you have 

Re: Loading Template

2008-01-17 Thread shabda

Save yourself the trouble of writing a view function and use the
generic view direct_to_template
http://www.djangoproject.com/documentation/generic_views/#django-views-generic-simple-direct-to-template

On Jan 17, 12:50 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Jan 17, 2008 2:32 AM, laspal <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi,
> > I wanted to know how can I load template without adding any
> > functionality to it.
> > Basically I just wanted to see how does my template looks.
>
> > MY view.py is :
> > from django.template.loader import get_template
> > from django.template import Context
>
> > def Main_Page(request):
> >t = get_template('MainPage.html')
> >html = t.render(Context({}))
> >   ???
> >???
>
> html = t.render(Context({}))
> return HttpResponse(html)
>
> That will render the template with an empty context and return the result.
> This will only work  if your template in fact does not need any context
> variables to render properly.
>
> Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---