Hey all. If you're like me and you like using
python3 -m venv for virtual environments but also want some fast venv switching at the command line (Linux/MacOS) then might try this dead simple Bash script of mine —
venv-activate— for venv creation and tab complete assisted venv switching. :wave:
python3 -m venv venv && . venv/bin/activate && pip install -U pip setuptools &> /dev/null
@mkennedy_twitter Indeed. Hard to get more lightweight than that. :) You make a good point though that there isn't really a clear use case to not upgrade and install pip, setuptools, and wheel — so I've fixed it. :+1:
The main reason I do a Bash functions rather than something like the above is just because I want to use (some) virtual environments in more ways then just being bound to a single project, and being able to know that if I want physics and stats libraries that I can just tab complete my way there is worth it to avoid interruption at times. :)
render_template(...)I've created a gist so that you can see my code.
app-mod.pyis how I got it to work after reading Flask docs.
app.pyis close to what is used in the course video. https://gist.github.com/ryentzer/c67af920790d750cc2ac1a1223ab501b
@ryentzer The problem with blueprints is that Flask does not run your main method. If you start your app as
flask run rather than
python app.py, it won’t work as is. Also, PyCharm can sometimes detect Flask projects and implicitly use
flask run. The fix is to add an else to the main invocation:
if __name__ == '__main__': main() else: register_blueprints() # and stuff like setup DB that would have been done in main
def __record_purchase_and_transaction(user, order, charge, amount_paid: float, description: str, payment_type: str, payment_method: str): mongosetup.init_db() payment = Purchase(payment_type=payment_type, payment_method=payment_method, description=description, paid=True, amount_paid=amount_paid, date_initiated=datetime.datetime.now(), currency_paid=charge.currency, stripe_charge_id=charge.id, item_fee_amount=order.item_total_cost, service_fee_amount=order.service_cost) order.status = 3 # just for sake of saying that order has been paid + received order.purchase_details = payment order.save()
This part is just the routing to a certain view:
/courses/details/ and this part is that unique ID:
When the view is loaded, just do a query in MongoEngine:
Hello fellow TPTM listeners, I'm looking for a coding buddy --- someone to code with on Saturdays (or every other Saturday) for 4 hours. I want to be more consistent working on my personal projects so I’m looking for someone to be accountable to while also helping each other: having someone to bounce ideas off, share learning resources with, help in research, etc.
What I Can Help You With
I’ve finished AppBrewery's Complete Flutter (App Development) Bootcamp [with Dart]. I’ve done projects in Python and also a full-stack web developer in a previous life so I know my way with front-end tech. You can find my code in GitHub (/paxcodes). I also have Python / Full-Stack projects I've completed for work but not available in GitHub: A lot of creating automation tools: backend API and CLI apps in Python, Vue for frontend, and a tiny bit of Docker.
What You Can Help Me With
I have a personal app/hobby project in Flutter with FastAPI as the backend API. I’m using the pattern in tiangolo’s cookiecutter full-fastapi-postgres… (+ dockerswam.rocks) for deployment, deploying in Linode.
If you feel like I can help you with your personal project, and you can help me in mine, please give me a shout...or maybe you're a senior interested in mentoring a beginner-intermediate person like me, that's cool, too! 😅
(This message is quite long. Feel free to delete @mkennedy_twitter if not appropriate. 😊 )
I'm trying to find the name of that library that is a wrapper around temp file that renames on close to the final file name. It may have been mentioned in python bytes, not sure. Pretty sure it was mentioned within the last 12 months. Anyone recall?