New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move towards virtualenv #203
Comments
Yes! I've been wanting to do this for a while, but lacked the knowhow to do it properly. |
It's pretty straight forward.
If you are using it from command line you can activate your env by doing To install stuff into your env via pip, use You can also have a |
Well, I get that part, and have done that from the command line. I was referring more to how I would integrate into being used by Mycodo. |
:) (sorry for stating the obvious) When the daemon launches, the python script gets called. You could just call a wrapper that says Then it should run out of your env. The only trick would be if you manually kick off other python scripts from within your script, i.e. something like Am I helping at all? |
That helps, but I'm still at a loss of how to start and how involved it will be to get the frontend and backend both running in a virtualenv. |
So let's pretend you use your setup script to create a folder For any python call, you need to call the script with As for your frontend, you need to install and run uwsgi from within your python env. Take a look at this tutorial for setting up nginx: So on a system I have that deals w/ sms messages, if I check my service I see this, meaning it runs from my virtuale env.
|
That seems pretty easy. I've also wanted to experiment with nginx performance. I'll check it out once I get this new install going. |
Here's my progress so far:
|
I think I have everything working with the virtual environment, from setup to updating. I'll run a fresh install sometime in the next few days to test it. In the System info page, I added to the system checks at the top to indicate whether the frontend and backend are in a virtualenv, just to make sure it's working as I test. |
very cool! Yeah wouldn't worry much about the NGINX stuff, you're likely just stuck on a configuration issue, and to be honest the type of hosting mycodo is doing can be run on any webserver. I prefer NGINX cuz I find it to be a lighter weight deploy. |
It's all running great right now. I'm going to go for a long uptime on the new Pi3 I installed dev-5.0 on. I wasn't able to get through the errors with the nginx config. It started but the app would crash at the first request. I believe it was a config/database issue. I'll revisit it in the future. If you have experience with nginx and would like to see if you can get a stable config, please do ;) |
Just remembered the last issue I was having with the nginx config was SSL, because the flask app forces SSL by default. |
Mycodo Issue Report:
Problem Description
Currently you install python versions via the global python and pip. You should move towards installing a virtualenv in your install dir and running the daemon with an isolated python instance.
The text was updated successfully, but these errors were encountered: