-
Activate the virtual environment
Install virtualenv if not available
pip install virtualenvpython3 -m venv env or python -m venv env source env/bin/activate
Or
. env/bin/activateWindows (Command Prompt)
virtualenv myenv ##(name of the env) myenv\Scripts\activate env\Scripts\activate.bat
To check Python environment (Windows)
where python C:\Users\..\..\env\Scripts\python.exe C:\Users\..\AppData\Local\Programs\Python\Python310\python.exe C:\Users\..\AppData\Local\Microsoft\WindowsApps\python.exe
To list all installed packages
pip list -
To delete virtual environment
rmdir env /s -
To deactivate the virtual environment
deactivate -
Install requirements
pip3 install -r requirements.txt -
Get packages from main Python environment
python -m venv env --system-site-packagesCheck for local Python packages
pip list --local -
Setting up the flask development environment
export FLASK_ENV=development export FLASK_APP=/src/app.py #optional
-
Run app locally
FLASK_APP=src/app.py flask runOr
python -m flask runOr
flask run flask --app app(name of the file) run --debug #auto reload
The server will be up on
http://127.0.0.1:5000/ -
Run tests
Specify the folder
testspython -m pytest testsOr It will look recurcisvely for the
test_*.pyfilespython -m pytestOr
py.test -v -
Flake8 settings
.flake8used by Github Actions.github/workflows/lint-test.yaml -
pipreqsfor requirements -
Docker build and docker run
docker build -t flask_app:v1 . docker run flask_app docker container run -d -p 5000:5000 flask_app:v1
-
Check for Dockerfile Linter
docker run --rm -i hadolint/hadolint < Dockerfile -
Docker debug
docker container prune # to remove existing containers. docker-compose build --no-cache # to rebuild docker images. docker-compose up --build --force-recreate docker stop $(docker ps -aq) # to stop all running dockers docker ps # to list of all running dockers docker run -p 5000:5000 docker_image # to run on port 5000
-
Docker verify installation
docker run --name repo alpine/git clone https://github.com/docker/getting-started.git cd getting-started docker build -t docker101tutorial . docker run -d -p 80:80 --name docker-tutorial docker101tutorial docker tag docker101tutorial naeem15/docker101tutorial docker push naeem15/docker101tutorial
-
Typescript setting
tsc main.ts --outFile ../js/main.js --watch -
Sass
sass --watch main.sass ../css/main.css -
Conda (windows)
conda create --name env_name python=3.11 conda activate env_name conda deactivate
-
Notifications
You must be signed in to change notification settings - Fork 0
naeem-bebit/data-project
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Project Flask
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published