DEV Community

loading...

Do you have Python tips?

adaendra profile image Maxime Guilbert ・1 min read

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!

Discussion (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
adaendra profile image
Maxime Guilbert Author

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
adaendra profile image
Maxime Guilbert Author

Yes, for sure!
Thanks

Forem Open with the Forem app