How to Setup and Start your Python Application

Once can write a very complicated application in python. As in other languages, you compile application to executable and then you start your executable. Unlike starting an executable, python is more scripting type of language and thus does not require compiling the application and thus no executable.

If your python is in single file, it is not an issue to start your application. You do

python yourapp.py

Whala your app is running. However, if you are writing an application, then you have fairly complex code/class organization. This means, python needs to know how to navigate your code.

When you are developing in IDE like pycharm, the IDE helps you to create environment and then proper paths. However, when you are deploying, you will need to setup either through scripts or manually. Following are few steps you should follow in setting up your application.

  1. Create a virtual environment – this will make everything every easy and localize your python environment to your application
  2. Install all the packages that you need through a requirement file
  3. Set a root path that is PYTHONPATH which sets a root path