One of many case of the VendOPrint project
- Install
virtualenv
pip install virtualenv
- Create and move into the project directory
mkdir projectA
cd projectA
- Activate the virtual environment (for linux)
source env/bin/activate
- Verify whether the virtual environment is created successfully
pip list
This will list all the dependencies of the virtual environment
Congratulations you have isolated application dependencies from the system dependencies!
pip freeze > requirements.txt
This will list all the dependencies of the application, which can be used to replicate across different systems
- Install python-dotenv to interact with environment variables.
pip install python-dotenv
- create an .env file to store secrets or configuration information
touch .env
- Open the environment file(linux)
nano .env
- open the environment file and past the following lines
AWS_ACCESS_KEY_ID = 'your_aws_access_key'
AWS_SECRET_ACCESS_KEY = 'your_secret_access keys'
AWS_S3_BUCKET_NAME = 'your_bucket_name'
DB_HOST = 'your_db_host'
DB_USERNAME = 'your_db_username'
DB_PASSWORD = 'your_db_password'
DB_NAME = 'you_db_name'
- Exit the nano editor
ctrl + s and ctrl + x
- Add a .gitignore file
touch .gitignore
- Add .env to .gitignore file to prevent it from being committed to codebase