Is there any adequate scaffolding for Django? (A la Ruby on Rails)

前端 未结 6 1504
遇见更好的自我
遇见更好的自我 2021-01-31 17:34

Is there any adequate scaffolding for Django?

It may be in the newly released 1.3 version, but I haven\'t found it yet.

6条回答
  •  抹茶落季
    2021-01-31 18:12

    I just used the scaffold helper/management command provided by Django Common and it seems to have set up a decent chunk of boilerplate code. The options are limited, but decent enough.

    I skimmed through the code and most of it looks fine. I needed to do a little bit of cleaning up, once the scaffolding was 'erected', though:

    • Separate import lines were added for each model created. Merged them.
    • The templates still carried the old (1.4) url template tag specs. Modified them to reflect the new (1.5) specs, i.e. enclosed the second parameter in single quotes, in each of the html files created, for each of the models.
    • Updated the main urls.py with an include for the app.urls module.
    • I use a non-standard settings.py setup - three separate files common.py, dev.py and prod.py for my setup. Had to add the app manually to the installed apps. YMMV.

    (Will edit this list if I think of anything else)

    That being said, looking at the amount of boilerplate code that I did NOT have to write, I'd say it does a very good job!

    As of now, the repo seems pretty well-maintained - the last commit was 18 days ago at the time of writing this response. I'll probably submit a pull request/raise an issue about the problems I faced on their repo, some time soon.

提交回复
热议问题