Show HN: importd – d is for django
pythonhosted.org
pythonhosted.org
Simon Willison (one of the Django core devs) made a Django micro framework a few years ago, I don't think its been developed much recently though.
http://simonwillison.net/2009/May/19/djng/
http://news.ycombinator.com/item?id=615891
-
EDIT:
Simons website seems to be down, an overview of Djing is here: https://github.com/simonw/djng
Two thumbs up, from me.
I've tried a few different apps designed to move settings into the database. None of them have worked very well. This area of Django is still ripe for some killer app to become a defacto standard.
in .... settings.py put
from local_settings.py import *
at the bottom
then have
local_settings.dev.py local_settings.prod.py local_settings.release.py
that you copy to local_settings.py depending on the situation.
http://tech.yipit.com/2011/11/02/django-settings-what-to-do-...
* settings/base.py * settings/production.py * settings/local.py
settings/base would have your "common" settings, settings/local.py could be as simple as from .settings.base import
First, it still makes you put all application config into a single config file (considering that even if you "inherit" settings from a common file, it's 100% equivalent to having one big settings file).
Second, you cannot change these settings in-app. They are hard-coded.
I understand the concern about magic, and moving parts. I guess the right answer to that concern would be unittests, that I am in the process or writing.
I hope you enjoy the module as much as I do :-)
I think it is really interesting, but cant find a good example where I should use it
The primary motivation was when making it easy to use django for API like apps. Moving to flask etc meant losing all the django knowledge and batteries. Most simple project start small, and importd makes it easy for starting small, yet importd intends to remain completely compatible with django.
importd already can play nicely with rest of django ecosystem, and I am trying to figure out what more I can do to make that easier.
I'll be trying it out soon :)
However, I wouldn't use it for a full-blown app. It's like using Flask. You could do it in a single file, but it rarely makes sense to do so. By the time you organize your code, you end up with a basic MVC app structure anyway.
Relocateable by default is nice. But it's pretty simple in Django to design your settings file to be path-relative.
https://github.com/davidwtbuxton/django-mini
I wrote it to make it easier to run tests for plug-able Django apps.
importd makes it easy to start using django for simple couple of pages/api apps, and it remains compatible with rest of django, that is the goal.
Additionally, there's another thing that importd side-steps: now there is no more settings.py. While I understand why, there is a reason for it to exist: configuration and code do not always mix. Sometimes you need a dev key and a prod key; sometimes you need different IP addresses set in different config files and you cannot autodiscover them (e.g.: they are not addresses from the same box). Having a better settings.py would go a long way towards solving this as compared to eliminating it altogether.
It'd be really nice if there was a fast, automated way to "unwrap" the microframework version of your webapp into the full-blown django project so that you can start hardening things for production in a single command.
ImportError: No module named wsgi
I updated to 1.4.5 and it worked fine.