DEV Community

Maxime Guilbert
Maxime Guilbert

Posted on • Updated on

Do you have Python tips?

Hi everyone,

I'm pretty new in Python devs and I want to know which code structure are you using? Are there some tips to have a clean Python code?

Based on multiple GitHub projects, the one that I used looks like this.

  • controllers
  • models
  • resources
  • routes
  • services
  • static (for webapps exposed by Flask)
  • templates (for webapps exposed by Flask)
  • server.py

Do you have some other tips for Python projects?


Thanks for your help!

Top comments (4)

Collapse
 
aminnairi profile image
Amin

If you are using (or want to use) the Fish shell, you can use a Fish Function to make your python command run a container with some default options (Python example linked at the end of this article).

Here is how it could look.

$ python -p 8000:8000 -- server.py --host 0.0.0.0 --port 8000
Enter fullscreen mode Exit fullscreen mode

And if you are not using Fish, you will probably have learned one thing or two. Win win.

Collapse
 
mxglt profile image
Maxime Guilbert

Thanks for the information!

Collapse
 
devlorenzo profile image
DevLorenzo

If you want I have a list of Python IDE / Tools. Do you want me to post it here?

Collapse
 
mxglt profile image
Maxime Guilbert

Yes, for sure!
Thanks