TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Advice whether to start the following open source django project

1 点作者 gamebit07大约 13 年前
There are tools like pyflakes and pep8, which tell you if the code you have written meets certain standards of readability. I wanted to apply the same thought, given a django project test if it meets certain standards or not. I went through different sources available on the web and came up with some action items(listed below).<p>I wanted comments/feedbacks/insights from fellow hackers.<p><i>Is it worth the effort?</i><p>One reason i want to do it is because it will make the project look more organized and easy for someone to read the code and understand. The design guidelines are not my own and have been taken from authentic sources(listed at the end of the post)<p>One reason i doubt doing it is, people might have different requirements and people should be free to do things their own way. These are only few generic stuff and an experienced programmer will himself take care of it, as per the needs. Besides i am relatively inexperienced and it will take me some considerable amount of time to code.<p>Please let me know your thoughts.<p>Following would be my requirement list:<p><i>Templates</i>:<p>There should be one base.html at the project level, and one base.html at each of the app levels. The app level base.html should extend the project level base.html; {{ foo }} not {{foo}};<p><i>Settings File</i>: Use relative path in settings.py; Sensitive things as database password API keys in localsettings; Custom Middlewares and Context Processors should have try catch;<p><i>Urls</i>: Each of the urls should have a name, corresponding to the view name There should be one urls.py at the project level, and one urls.py at each app level. The project level urls.py should include each of the urls.py under a prefix. Do not use primary key in urls.<p><i>Models</i>:<p>Field naming Convention: first_name not FirstName; Use Model Forms instead of Forms; There should be a __unicode__ method and use of permalink; Instead of get_absolute_url; The model of inner classes should be as follows: db fields managers meta class db fields managers unicode str save absolute_url<p>Following are the sources i went through to make the above list:<p>1.http://lincolnloop.com/django-best-practices/<p>2.http://www.sparklewise.com/django-settings-for-production-and-development-best-practices/<p>3.https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/<p>4.http://assets.en.oreilly.com/1/event/27/Django%20in%20the%20Real%20World%20Presentation.pdf

暂无评论

暂无评论