The Wayback Machine - https://web.archive.org/web/20210119193535/https://github.com/realpython/python-guide/issues/996
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please add flask in "Structuring Your Project" #996

Open
Yensan opened this issue Apr 14, 2019 · 6 comments
Open

please add flask in "Structuring Your Project" #996

Yensan opened this issue Apr 14, 2019 · 6 comments

Comments

@Yensan
Copy link

@Yensan Yensan commented Apr 14, 2019

Writing Great Python Code
---- Structuring Your Project
----------Regarding Django Applications

Structure of Code is Key, it is true. In this paragraph, someone writes about Django, but I must say Flask is a big problem, because when you use django shell to create a project, it will always as it designed, if you use Flask... project structure will be different with everyone. For this reason, I think flask is not safe for human consumption at all. 😆
If anyone can create an example project ?

@kedod
Copy link

@kedod kedod commented Apr 28, 2019

What about cookiecutter templates?
https://github.com/sloria/cookiecutter-flask
https://github.com/candidtim/cookiecutter-flask-minimal
https://github.com/karec/cookiecutter-flask-restful

In my opinion there is no perfect project structure. It also applies to Django and any other python web framework.

@zachvalenta
Copy link
Contributor

@zachvalenta zachvalenta commented Jun 18, 2019

@Yensan I agree w/ you that structuring Flask projects is more open-ended than Django.

Rather than pulling Flask into the guide, however, I think the section entitled 'Regarding Django Applications' should be edited to 'Avoid Repetitive Paths'.

I've written a blog post about this problem, a lot of Python projects in addition to Django make this mistake.

@Yensan
Copy link
Author

@Yensan Yensan commented Jul 5, 2019

@Yensan I agree w/ you that structuring Flask projects is more open-ended than Django.

Rather than pulling Flask into the guide, however, I think the section entitled 'Regarding Django Applications' should be edited to 'Avoid Repetitive Paths'.

I've written a blog post about this problem, a lot of Python projects in addition to Django make this mistake.

@zachvalenta However, for me, 'Repetitive Paths' is not a problem at all. Some weeks ago, I took over a flask project that just like spaghetti, I almost want to kill myself. Then, I made a fake Django from Flask, and fake django-rest-framework is on the way.

@return42
Copy link

@return42 return42 commented Jul 5, 2019

@zachvalenta sorry, but I have to say, that your blog post is totally wrong. Please take a look at https://docs.python-guide.org/writing/structure/#sample-repository for an correct example.

Some more words to clarify .. correct me if I'am wrong:

  1. The problem named in chapter "-Regarding Django Applications" is. that django creates <repo-foo>/<src-foo>/<py-pkg-foo> where all folders are named foo.

  2. The correct form from the example is <repo-foo>/<py-pkg-foo>

  3. In your blog post you recommend <repo-foo>/src

BTW: in your blog post the flask example is not true (anymore) and in your 'hope' section you say:

here are exceptions. pytest and Pillow both put their source code in, well, src."

.. please double check the projects you refer. E.g. pillow uses the src folder for C-sources and Py-sources, which is not common use case. There are so many bugs your blog post, confusing beginners .. please drop it.

@Yensan
Copy link
Author

@Yensan Yensan commented Jul 5, 2019

.. please double check the projects you refer. E.g. pillow uses the src folder for C-sources and Py-sources, which is not common use case. There are so many bugs your blog post, confusing beginners .. please drop it.

@return42 Thank you. He just a nice guy and want to help... 'drop it' have some tone. Every one can keep his opinion.

@Yensan
Copy link
Author

@Yensan Yensan commented Aug 6, 2019

@kedod
thank you. But I build an fake django with Flask. Welcome to commit!!!
https://github.com/Yensan/Schurz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.