I have a server which has this structure.
Nginx -> uwsgi(port:8011) DjangoA
-> uwsgi(port:8012) DjangoB
I developed with pipenv in local.
pipenv shell
pipenv manage.py runserver
Now I want to put this on server with
At first I try this on capistrano
task :bundle do on roles(:app) do
#execute "/home/ubuntu/.pyenv/shims/pip install -r #{release_path}/requirements.txt"
execute "/home/ubuntu/.pyenv/shims/pipenv install"
end
end
task :migrate do on roles(:app) do
execute "/home/ubuntu/.pyenv/shims/pipenv run python #{release_path}/manage.py makemigrations"
execute "/home/ubuntu/.pyenv/shims/pipenv run python #{release_path}/manage.py migrate"
end
end
task :assets do on roles(:app) do
execute "yes yes | /home/ubuntu/.pyenv/shims/pipenv run python #{release_path}/manage.py collectstatic"
end
end
However even after pipenv installing , there is no library appears. (or it is not correctly installed??)
DEBUG [50051834] Command: /home/ubuntu/.pyenv/shims/pipenv install
DEBUG [50051834] Installing dependencies from Pipfile.lock (db4242)...
DEBUG [50051834] ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
DEBUG [50051834]
DEBUG [50051834] To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
INFO [50051834] Finished in 1.239 seconds with exit status 0 (successful).
INFO [8a6402ea] Running /home/ubuntu/.pyenv/shims/pipenv run python /var/www/html/sokuapi/releases/20220901070724/manage.py makemigrations as ubuntu@koala.example.jp
DEBUG [8a6402ea] Command: /home/ubuntu/.pyenv/shims/pipenv run python /var/www/html/sokuapi/releases/20220901070724/manage.py makemigrations
DEBUG [8a6402ea] Traceback (most recent call last):
File "/var/www/html/sokuapi/releases/20220901070724/manage.py", line 11, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
So, I have a few questions.
- Is it possible to use pipenv to separate the environment in one server??
- Is there any other best practice to separate enviroment on server?