I have a django project, that works similar to Jupyter Notebook, in terms of Being a program launched offline in localhost on a web browser, moreover my webapp has an opencv webcam pop-up, that will be launched when you press a button.
I want to deploy my django project, so it can be launched by just clicking a file in Windows.
According to what I read, There are two possible solutions:
- Install Python Interpreter with Dependencies on client computer first, and using a bat file, to launch the django server.
- Containerizing the Django project with Python and its dependencies, either using Docker or perhaps an exe file?
Which solution is better? I would prefer the second one personally, but I’m confused how to do so.
Can it be done as simple as using pyinstaller or not?
Here are my dependencies for reference:
Django pillow django-object-actions django_user_agents django-cleanup opencv-python imutils cmake dlib face-recognition
CodePudding user response:
I think that the best practise would be to use containers like e.g. docker. After that you have the following benefits:
- Dependencies inside the container machine (automatically with pip install from requirements file)
- Multiplatform possibility
- Versioning with tags
- You can run database in a second container if needed (combined with docker compose)
- Click and run with docker desktop
fyi: There a lots of tutorials on how to deploy django in docker containers :)