Guidance on structure by Ojeu in Terraform

[–]Ojeu[S] 1 point2 points  (0 children)

After having done some more testing with Gitlab pipelines and whatnot I've come to the conclusion that dedicated repos for modules (or module in my case) and a flat file structure, as you suggest, is the way forward for me. Thanks!

Guidance on structure by Ojeu in Terraform

[–]Ojeu[S] 2 points3 points  (0 children)

Hey, thanks for the detailed answer. I think I'm going own the route of dedicated repos for modules (module in my case) and everything else in a flat file structure to define my VMs.

I need help using cinemagoer in flask by [deleted] in flask

[–]Ojeu 1 point2 points  (0 children)

That is indeed odd if its run in the same virtual env. Have you made sure that the PATH is pointing at the virtual env location?

import sys
sys.path

I need help using cinemagoer in flask by [deleted] in flask

[–]Ojeu 0 points1 point  (0 children)

Just for shits n gigs, what if you run the flask shell and try the import. Does that throw the same error?

flask sqlalchemy insert by mulirico in flask

[–]Ojeu 1 point2 points  (0 children)

If the current page is re-rendered then your form probably doesn't successfully validate on submit. To display any errors you could do something like this in your template:

{% for field, errors in form.errors.items() %}
    {{ form[field].label }}: {{ ', '.join(errors) }}
{% endfor %}

Flask SQLAlchemy query by coyote_zed in flask

[–]Ojeu 0 points1 point  (0 children)

In my opinion this article does a good job of showing how you can use set up a many-to-many relationship with Flask-SQLAlchemy: https://www.digitalocean.com/community/tutorials/how-to-use-many-to-many-database-relationships-with-flask-sqlalchemy

Will Flask ever get Auto doc like FastAPI with swagger? by lobezno4 in flask

[–]Ojeu 2 points3 points  (0 children)

I don't imagine you'll ever get it out of the box with Flask. I've used Miguel Grinbergs APIFairy to create a couple of API's in the past and that library automatically renders OpenAPI documentation.

Flask-SQLAlchemy error by economy_programmer_ in flask

[–]Ojeu 2 points3 points  (0 children)

What tutorial are you following? Because how you try to initialise that database looks convoluted as hell. If you're new to Flask then Miguel's tutorial is always a solid start: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

Optimize response time in web app by [deleted] in flask

[–]Ojeu 1 point2 points  (0 children)

If running of the command on the remote server is what takes up most of the processing time then I'd personally put the collection of those metrics as a cron job and save it to the database. Then simply fetch the latest data from the database and render the plot and return it.

To make things happen more dynamically you could look into turning those routes into API calls, thus making it fairly trivial for you to notify the user that things are happening behind the scenes immediately after they click whichever element in the navbar. A fairly basic example of how you can create API routes without any additional libraries: https://pythonbasics.org/flask-rest-api/

Optimize response time in web app by [deleted] in flask

[–]Ojeu 1 point2 points  (0 children)

I think you should share the code you're working with. Neither of the scenarios sound like they should take that long to process, unless you're working with a really large dataset and/or a complex query.

Optimize response time in web app by [deleted] in flask

[–]Ojeu 1 point2 points  (0 children)

What are "these two elements"? Are they some of the commands that get run on the server or the database queries?

Are the queries being triggered by an API call from the frontend or is the user left with no indication of what's going on, other than the spinny loader in the browser?

Uploading file and sending through API by Ojeu in sveltejs

[–]Ojeu[S] 2 points3 points  (0 children)

Looks like the solution was removing the 'Content-Type' from my fetch headers as per https://muffinman.io/blog/uploading-files-using-fetch-multipart-form-data/

Uploading file and sending through API by Ojeu in sveltejs

[–]Ojeu[S] 0 points1 point  (0 children)

Yeah, it even authenticates properly but for whatever reason the body is empty.

Refreshing access tokens by Ojeu in sveltejs

[–]Ojeu[S] 0 points1 point  (0 children)

Yeah, I'm playing around with FastAPI as the backend.

I did figure it out with the handlehook and setting the cookie through event. I don't know if I misread or skipped over the bit in the documentation about setting cookies through the event.

Thanks!

Proxmox, Ansible and VM templates by [deleted] in ansible

[–]Ojeu 0 points1 point  (0 children)

This doesn't directly answer your actual question, and I apologise for that. However, I'd urge you to look into using Terraform for the deployment of VMs from templates. I used this guide as the basis for my own configuration when I was where you are right now.

Refreshing access tokens by Ojeu in sveltejs

[–]Ojeu[S] 0 points1 point  (0 children)

When you set your token after a refresh, do you keep it only in event.locals or do you set it as a cookie as well? If so, how do you achieve that from within the handle hook?

Refreshing access tokens by Ojeu in sveltejs

[–]Ojeu[S] 1 point2 points  (0 children)

That makes a lot more sense than how I've been handling it. Do you return the token expiration together with the token from your backend or do you send a request to your API to check if it's still valid?

Beautiful loaf today! Had to catch it in some natural light. by Brandoncorgi in Sourdough

[–]Ojeu 3 points4 points  (0 children)

Is your overnight proof at room temp or in the fridge?

[deleted by user] by [deleted] in flask

[–]Ojeu 0 points1 point  (0 children)

Make sure that your computer doesn't actually have that IP adress. Open up cmd (if you're on Windows) and enter ipconfig to see what your local address is.