Junior — Middle
How can you launch and configure an application on a Linux operating system?
sobes.tech AI
Answer from AI
The typical steps to launch and configure a Python application on Linux are:
-
Install the Python interpreter — ensure the required Python version is installed (e.g., via
apt,yum, orpyenv). -
Create a virtual environment to isolate dependencies:
python3 -m venv venv
source venv/bin/activate
- Install dependencies from the
requirements.txtfile:
pip install -r requirements.txt
- Configure environment variables (for database configuration or keys):
export DATABASE_URL=postgresql://user:pass@localhost/db
- Run the application:
- For simple scripts:
python app.py
- For web applications — via a WSGI server (e.g., Gunicorn):
gunicorn app:app
- Set up auto-start and monitoring (e.g., via systemd or supervisor) to ensure stable operation in production.
Thus, the process includes environment preparation, dependency installation, configuration setup, and application launch considering Linux system specifics.