I need to convert an existing desktop python application into a Django powered website. To do this I will likely have several Django apps each performing certain things.
What im not sure about is where to put all the existing python files for each app. Each app will require several existing python files. For a basic Django app most of the program logic would be in views.py. However the desktop application that I will be converting is large with several python files. In other words, I can't just dump the entire application into the views.py file of a Django app.
My thinking is that inside views.py I would make calls to the various existing python files stored in a sub-directory. Im just not sure what is best practice in terms of where to put all those files? Can I just create a new folder in an app for example called 'program' which will contain all the python files.
I presume the files shouldn't go into static, because that should be used for pdf's, css, etc? Should it possibly go into templates?
Just trying to find out this is typically done. Let me know if I haven't explained myself clearly enough. Thanks.
First of all, you can make views.py
, models.py
, etc. modules instead of single files.
You can also add other modules such as core
, helpers
, you name it, to contain business logic code that is not necessarily a view.
For example, my relatively large django app has roughly the following structure:
my_app
views
__init__.py
example_view_1.py
example_view_2.py
some_module
__init__.py
another_view.py
...
models
(all my app's models)
helpers
(helper modules)
backends
(authentication backends)
forms
(django forms)
third_party
(all third party packages - I use GAE so I must upload them)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With