Hi folks, we've not met, I lurk a bit. If only my Tuesday nights weren't taken. <br><br>I'm considering a GeoDjango talk at OS Bridge. Starting with geodjango-basic-apps, covering ctypes bindings for the core GIS libraries (GEOS/GDAL), spatial queries (GeoQueryset, etc.), mapping client integration (OpenLayers). Lots of other possibilities, GeoRSS/Atom feeds, KML, integration with map engines, case studies.<br>
<br>Kirby, looks like you'll be presenting at the GIS in Action conference this month. See you there perhaps eh. We should have an OSGeo booth setup. I'll be moderating a marine planning session covering tools we've developed with GeoDjango for web and PyQGIS for desktop.<br>
<br>Cheers, Tim<br><br><br>Tim Welch<br>Applications Developer<br>Ecotrust<br><br><br><div class="gmail_quote">On Wed, Apr 1, 2009 at 11:37 PM, Dylan Reinhardt <span dir="ltr"><<a href="mailto:python@dylanreinhardt.com" target="_blank">python@dylanreinhardt.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">If I understand your issue correctly, you want to mix new content created<br>
and managed by Django with legacy content that exists in the form of static<br>
html files.<br>
<br>
This is actually easier than it sounds. There are many possible solutions,<br>
but here's one. Whether it is the right one will depend on how much of what<br>
type of stuff you have.<br>
<br>
So let's say you have a model you're using for content. And let's say you<br>
want this model to represent a "page" whether that page is new (managed by<br>
Django) or legacy (exists in file). That way both types of "page" can be<br>
managed by the same views at similar URLs. If you want that content object<br>
to do double duty, here's what you might do:<br>
<br>
1. Add a FilePathField to your model. Docs:<br>
<a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#filepathfield" target="_blank">http://docs.djangoproject.com/en/dev/ref/models/fields/#filepathfield</a><br>
<br>
2. Add a method to your model that returns the contents of the file at the<br>
path specified in that field<br>
<br>
3. In your template(s), check for the presence of a value in the<br>
FilePathField. If it's there, just dump out the contents of the file. If<br>
not, proceed to render your page as you normally would.<br>
<br>
If you end up with images that use relative paths that are no longer valid,<br>
you can probably fix those quickly with an entry in urls.py or an Apache<br>
RewriteRule. Shouldn't take much to map any legacy paths to the new static<br>
directory.<br>
<br>
Anyway... hope that's helpful.<br>
<br>
Dylan<br>
<div><div></div><div><br>
<br>
On Wed, Apr 1, 2009 at 10:59 PM, kirby urner <<a href="mailto:kirby.urner@gmail.com" target="_blank">kirby.urner@gmail.com</a>> wrote:<br>
<br>
> Thanks Dylan, plus to those replying off list.<br>
><br>
> I'm trying to wrap an old static HTML website in Django such that I<br>
> don't have to change relative paths to images in subdirectories that<br>
> won't really be there anymore. I'm wanting all URLs from the outside<br>
> world to stay the same as well i.e. all the old links will work as is.<br>
><br>
> <a href="http://www.4dsolutions.net/ocn/cp4e.html" target="_blank">http://www.4dsolutions.net/ocn/cp4e.html</a> will now point to<br>
> <a href="http://www.4dsolutions.net/controlroom/ocn/old/archive/cp4e.html" target="_blank">http://www.4dsolutions.net/controlroom/ocn/old/archive/cp4e.html</a> under<br>
> the hood, with the later containing <img src="graphics/pix.png"> tags<br>
> that need to be statically served from controlroom/media/ocn/graphics<br>
> -- that kind of thing.<br>
><br>
> Kind of a hack maybe, an exercise. The idea is new content would take<br>
> advantage of the framework more, but this is a way of grandfathering<br>
> in what's at the site already, basically with no changes.<br>
><br>
> Kirby<br>
><br>
><br>
> On Wed, Apr 1, 2009 at 5:12 PM, Dylan Reinhardt<br>
> <<a href="mailto:python@dylanreinhardt.com" target="_blank">python@dylanreinhardt.com</a>> wrote:<br>
> > This might help:<br>
> ><br>
> > <a href="http://docs.djangoproject.com/en/1.0/howto/static-files/" target="_blank">http://docs.djangoproject.com/en/1.0/howto/static-files/</a><br>
> ><br>
> > HTH,<br>
> ><br>
> > Dylan<br>
> ><br>
> ><br>
> > On Wed, Apr 1, 2009 at 4:59 PM, kirby urner <<a href="mailto:kirby.urner@gmail.com" target="_blank">kirby.urner@gmail.com</a>><br>
> wrote:<br>
> ><br>
> >> Django is driving me nuts I have to admit. It's the static media bit.<br>
> >> It's all on my Ubuntu laptop so if someone wants to show me where I'm<br>
> >> going wrong, the bagels are on me... (I had it working but then<br>
> >> decided to move directories around...). Write me off list maybe. I<br>
> >> live near the Bagdad.<br>
> >><br>
> >> Yeah, more Python talks would be good. I'm not altogether clear what<br>
> >> the audience will be like but I think there's always room for "just<br>
> >> the basics" i.e. a good old fashioned tutorial that doesn't go too<br>
> >> fast. I know we're into test driven development but I think doctest<br>
> >> is sufficient with noobs. Indeed, Python pedagogy is effective<br>
> >> because interactive...<br>
> >><br>
> >> I could see PPUG offering a standard once month free class with<br>
> >> rotating presenter, then spin-off more advanced topic classes that fly<br>
> >> when they fill, sort of Saturday Academy still. Having something like<br>
> >> a fixed schedule for the free ones, then scrambling amongst ourselves<br>
> >> to always have an instructor, would be a fun way to make PPUG a<br>
> >> stronger glue maybe. Just a thought.<br>
> >><br>
> >> Kirby<br>
> >> _______________________________________________<br>
> >> Portland mailing list<br>
> >> <a href="mailto:Portland@python.org" target="_blank">Portland@python.org</a><br>
> >> <a href="http://mail.python.org/mailman/listinfo/portland" target="_blank">http://mail.python.org/mailman/listinfo/portland</a><br>
> >><br>
> > -------------- next part --------------<br>
> > An HTML attachment was scrubbed...<br>
> > URL: <<br>
> <a href="http://mail.python.org/pipermail/portland/attachments/20090401/a977a3dd/attachment.htm" target="_blank">http://mail.python.org/pipermail/portland/attachments/20090401/a977a3dd/attachment.htm</a><br>
> ><br>
> > _______________________________________________<br>
> > Portland mailing list<br>
> > <a href="mailto:Portland@python.org" target="_blank">Portland@python.org</a><br>
> > <a href="http://mail.python.org/mailman/listinfo/portland" target="_blank">http://mail.python.org/mailman/listinfo/portland</a><br>
> ><br>
> _______________________________________________<br>
> Portland mailing list<br>
> <a href="mailto:Portland@python.org" target="_blank">Portland@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/portland" target="_blank">http://mail.python.org/mailman/listinfo/portland</a><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
</div></div>URL: <<a href="http://mail.python.org/pipermail/portland/attachments/20090401/c9253473/attachment.htm" target="_blank">http://mail.python.org/pipermail/portland/attachments/20090401/c9253473/attachment.htm</a>><br>
<div><div></div><div>_______________________________________________<br>
Portland mailing list<br>
<a href="mailto:Portland@python.org" target="_blank">Portland@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/portland" target="_blank">http://mail.python.org/mailman/listinfo/portland</a><br>
</div></div></blockquote></div><br>