Answer the question
In order to leave comments, you need to log in
Python application on Windows and Ubuntu how to organize?
Hello, I'm trying to figure out how to properly organize work on my project.
I use the Flask framework
, I work locally under windows, I bought a VPS with ubuntu remotely,
but immediately a lot of
questions
arise
. on ubuntu, I found a whole article (much more difficult) https://www.digitalocean.com/community/tutorials/h...
there you need to create several files, subfolders, etc. the structure will look something like this
|--------FlaskApp
|----------------FlaskApp
|-----------------------static
|-----------------------templates
|-----------------------venv
|-----------------------__init__.py
|----------------flaskapp.wsgi
file = open('/var/www/FlaskApp/FlaskApp/myfile', 'w')
Answer the question
In order to leave comments, you need to log in
1) Absolute paths are evil. There is no reason for you to use them.
2) There is an os module, which has the os.path.join function, which collects the names of folders / files, adding the necessary slashes.
As for the files, make a settings.cfg file, remove at least the path to your application in it.
import platform
if platform.system() == 'Linux':
MYAPPPATH = "/var/www/FlaskApp/FlaskApp"
else:
MYAPPPATH = "C:/FlaskApp/FlaskApp"
import platform
if platform.system() == 'Linux':
app.config["MYAPPPATH"] = "/var/www/FlaskApp/FlaskApp"
else:
app.config["MYAPPPATH"] = "C:/FlaskApp/FlaskApp"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question