amitu / importd

django based mini framework inspired from sinatra. fully compatible with django.
http://amitu.com/importd/
BSD 3-Clause "New" or "Revised" License
510 stars 30 forks source link

Enhancement: Auto-convert to standard python project #6

Closed alendit closed 11 years ago

alendit commented 11 years ago

I really like importd for some prototyping, but for something extensive the standard django structure is still the king.

It would be awesome if you could just run python app.py convert and get the usual project structure.

Not sure, what the best approach would be here. Some inspect-magic, maybe?

EDIT: should have been "standard django project" in the title.

amitu commented 11 years ago

Ah. That would be so much magic :-)

We already need standard django apps when we have to use django model api with importd. importd basically only gets rid of settings/manage/urls.py.

Can you post some more detail on how it would be done, what you suggested?

alendit commented 11 years ago

You can get the source of the views with inspect.getsource and render a views.py file from it, but you'll need vanila methods (not wrapped ones) for it. Then, you'll "just" need to generate url.py from the d.urlpattern and settings.py from the settings.

If you think it would be a nice functionality to have, I could look into it.