How to setup a python env for Web development

I’m planning to resume an old project i left incomplete back two months ago, at that time i was using archlinux so the procedure i follow to setup my environment:

# Create a new folder for the project
mkdir -p "~/dev/flask-project"

# Create a new virtual env (Pynthon already comes with arch)
python -m venv .env
pip install flask flask-mongoengine

# For this project i would need mongodb, so let's install it
sudo pacman -S mongodb

# Run the mongodb server
systemctl start --user mongodb

# Export variables to run the app
export FLASK_APP=app.py
export FLASK_ENV=development

Which is the nix equivalent of this? i’ve heard about creating a shell.nix file for compiling procedures regarding rust, but for this case how to can i setup a simple environment which can contain my configs without messing with my home folder or the system packages?

1 Like

I tend to use this method: nixpkgs/python.section.md at 34d9c48b55b0b43f414cf0375b17b80d3ca87848 · NixOS/nixpkgs · GitHub

There are other ways you can do it that are shown in the same document as well.