this post was submitted on 05 Jun 2024
2 points (100.0% liked)

Programming

17278 readers
436 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
top 6 comments
sorted by: hot top controversial new old
[–] SpeakinTelnet@sh.itjust.works 1 points 4 months ago

My secret to high uptime:

while True:
    try:
        main()
    except:
        pass
[–] drislands@lemmy.world 0 points 4 months ago

If you're on Linux (or Mac), add an alias to your .bashrc:

alias activate="source env/bin/activate"

Now you can activate your venv by just running activate in the project root!

[–] taaz@biglemmowski.win 0 points 4 months ago (1 children)

Not necessarily a trick that's always useful but I always forget this.
You can get async REPL by calling python -m asyncio.

Also, old trick - in need of simple http server serving static files?
python -m http.server

[–] amenji@programming.dev -1 points 4 months ago

Using http.server is my go-to sanity check method if my configured my network firewall correctly or not.

[–] beeng@discuss.tchncs.de 0 points 4 months ago (1 children)

Don't need to activate your venv to use it.

Just use venv/bin/python my-file.py from a script or a terminal from your project root.

[–] Mojave@lemmy.world 1 points 4 months ago

You don't need to use venv at all, break the mold and do it all global