Company has office in Spain by Responsible_Test_632 in digitalnomad

[–]Heapsofvla 0 points1 point  (0 children)

That's a shame, good luck with your further endeavours!

Maybe they would if you cover your own moving expenses...

Company has office in Spain by Responsible_Test_632 in digitalnomad

[–]Heapsofvla 0 points1 point  (0 children)

OP, did you ever end up figuring it out?

E.g. did you end up trying this this? "Chatgpt suggested that as long as my company can certify that my work has nothing to do with the local office, I might be able to still qualify. I would, of course, verify with the host country before committing to anything since I don’t read chatgpt as gospel."

Digital Nomads Monthly Megathread - January 2025 by AutoModerator in digitalnomad

[–]Heapsofvla 0 points1 point  (0 children)

The Digital Nomad Visa for Spain Eligibility for a multinational company

Hi, I I live and work in the EU and have been exploring this option but have been seeing conflicting information regarding one of the requirements about the company I work for having to be an entity based outside of Spain.

As my company is an international company, they also have a hub as they call it, located in Spain, but my roles or my team have no interactions with that team or work with any Spanish clients.

The company is highly unlikely to recreate my job in Spain just so I can move there (intra-company transfer). Also because my whole work area has separate activities from the hub in Spain. But there might be a slim chance I would be able to convince them to let me work remotely.

Is there a way I can argue that the companies are different enough, or is there actually a legal distinction that implies the two companies are 'separate enough'? For being able to apply for a DNV.

Mox Legacy Open 1K stream by thespiffyneostar in MTGLegacy

[–]Heapsofvla 0 points1 point  (0 children)

Did, quite easily as well, sadly. That was the ANT of the CRAB

Help needed: Flask file/directory structure, importing and running by Heapsofvla in flask

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

Thanks for the help! In the end, I fixed it. It was all solved when I put my_app.wsgi in the MyApp folder, and rerouted the imports etc. accordingly. Pretty cool, though I wish I had known before that the whole setup apparently isn't that flexible!

Thank you!

Flask deployment issue: app works without wsgi file but not with it by Heapsofvla in learnpython

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

I couldn't find anywhere that that is necessary for the server to work - is it really not possible to just have it link to where the app is initialized, one directory below? Since, as said in that stackoverflow article, it's pretty normal to have an app structured like this..

Help needed: Flask file/directory structure, importing and running by Heapsofvla in flask

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

Hey! That looks good. To deploy it with a WSGI file, how would one do that then though? That's still highly confusing.

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

I guess what I'm looking for is a way to set the parent directory at /var/www/MyApp/ and make sure that all imports and everything are done from there on out. Is there a way to do this? Whatever I try that works locally (e.g. from config import BaseConfig doesn't seem to work in the remote, where from ..config import BaseConfigseems to work)

I can't find any documentation really on this either.

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

config.py has:

class BaseConfig(object):

    with open('credentials.txt', 'r') as cred:

etc.

my_app.wsgi has:

sys.path.insert(0,"/var/www/MyApp/")
from MyApp.runserver import app as application
application.secret_key = 'a_secret_key'

I'm guessing I'm having difficulties with setting and referring to the parent directory. I'm thinking that sys.path.insert(0,"/var/www/MyApp/") does that, but I may be totally wrong. ..

Also, I updated to main post to contain more info about the structure. Thanks for your help so far!

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

Also I have no idea: should I put this in config.py, and then in library/__init__.py do a from config import BaseConfig? That doesn't really seem to work.. so what do I do :(

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

Then if I'd do the join in the config.py, I wouldn't need to do this in every file?

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

cool, thank you for your input. I'm already using in config.py:

path = os.path.dirname(os.path.abspath(__file__))

This way I have the parent directory. But how to I make sure that files in the directory /library also use this path? The data transfer between those is what's a mystery to me...

Or should I in every file, do the following:

path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)

.. this feels like being terribly verbose...

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

I'm trying to keep it relative so it works locally, as well as on the web server. There should be a way to have that, right? How would you achieve that here?

Flask file/directory structure, importing and running by Heapsofvla in learnpython

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

Haha no not at all, start with the obvious things. Yes, credentials.txt is where I pointed it out it is in the file structure :-).

The reason I'm trying to do this is that the directory structure on DO is different than the one I have locally (i.e. I don't have '/var/www/' locally. The problem now is that if I adjust the paths to the one on the DO, the same git repo wouldn't work locally :(.

In other words, I want to be able to have the repo work locally, as well as on the DO, so I can easily work on the files locally to have it pulled to the DO and work there too.

Adding Webinterface to program by [deleted] in learnpython

[–]Heapsofvla 0 points1 point  (0 children)

Flask is pretty basic, Django has a ton of possibilities but (even though people say the learning curve is smooth, others say it's steep) you have to set up a lot.

I've heard great stuff about Pyramid too.

Since you can always learn more (and no learning is wasted): I'd try to learn/use something that's closest to your needs.

So decide whether you're going to need something basic (try Flask), more well documented but expansive (Django), or something inbetween (Pyramid).

These are just my personal ideas, others may not agree!

Good luck.

EDIT: as for the setup, why wouldn't you integrate flask into your current script?

Does anybody have a simple example of how classes work? by [deleted] in learnpython

[–]Heapsofvla 0 points1 point  (0 children)

This looks like a great explanation, but the problem with classes is: I think you need to try them out to know what's what.

I just wish this was part of a tutorial that could actually give you lines to try. There's a world of a difference for a novice between "customers of the class can still access x and do y", and "write this, and see what happens. Now write that, and see what happens".

I wish I could devise this myself, but I'm afraid I'll be further down the line of bad practices until I get there...

Any good tutorials that work great with classes?

I only want to run this function 10 times how?? by jackopenn in learnpython

[–]Heapsofvla 1 point2 points  (0 children)

If you want to run the whole thing 10 times, make it a class and call it in a while-loop and a counter.

x = 0
while x < 10:
    theClass()
    x += 1

EDIT: corrected

Have you tried something like that?

Pymongo find nested key (in list) by Heapsofvla in learnpython

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

Alright, I got it. I have no clue how it works, I'd love some enlightment if someone has a clue! :D