Installed gunicorn but it is not in venv/bin folder

2024/9/29 13:15:01

I'm new to gunicorn and trying to deploy a django website on an ubuntu. I have used:

pip3 install gunicorn
sudo apt-get install gunicorn

but when I want to fill this file:

sudo nano /etc/systemd/system/gunicorn.service

and I fill it with:

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myprojectdir
ExecStart=/home/sammy/myprojectdir/myprojectenv/bin/gunicorn \--access-logfile - \--workers 3 \--bind unix:/run/gunicorn.sock \myproject.wsgi:application[Install]
WantedBy=multi-user.target

but there is no gunicorn file in /bin what is the missing part?

by using this command:

sudo journalctl -u gunicorn.socket
sudo systemctl status gunicorn

gunicorn.service: Failed at step EXEC spawning /home/tw/tw_git2/tw_git2/ninipayenv/bin/gunicorn: No such file or directory

Answer

it can be fixed with removing the previous venv and creating a new one to be sure that pip3 that is been used is inside the venv.

https://en.xdnf.cn/q/71209.html

Related Q&A

Does Pythons asyncio lock.acquire maintain order?

If I have two functions doingasync with mylock.acquire():....Once the lock is released, is it guaranteed that the first to await will win, or is the order selected differently? (e.g. randomly, arbitra…

Howto ignore specific undefined variables in Pydev Eclipse

Im writing a crossplatform python script on windows using Eclipse with the Pydev plugin. The script makes use of the os.symlink() and os.readlink() methods if the current platform isnt NT. Since the os…

Faster way to calculate hexagon grid coordinates

Im using the following procedure to calculate hexagonal polygon coordinates of a given radius for a square grid of a given extent (lower left upper right):def calc_polygons(startx, starty, endx, endy,…

Why is -0.0 not the same as 0.0?

I could be missing something fundamental, but consider this interpreter session1:>>> -0.0 is 0.0 False >>> 0.0 is 0.0 True >>> -0.0 # The sign is even retained in the output…

scrapy: exceptions.AttributeError: unicode object has no attribute dont_filter

In scrapy, I am getting the error exceptions.AttributeError: unicode object has no attribute dont_filter. After searching around, I found this answer (which made sense as it was the only bit of code I …

Django Class Based View: Validate object in dispatch

Is there a established way that i validate an object in the dispatch without making an extra database call when self.get_object() is called later in get/post?Here is what i have so far (slightly alter…

Python very slow as compared to Java for this algorithm

Im studying algorithms and decided to port the Java Programs from the textbook to Python, since I dislike the Java overhead, especially for small programs, and as an exercise.The algorithm itself is ve…

fd.seek() IOError: [Errno 22] Invalid argument

My Python Interpreter (v2.6.5) raises the above error in the following codepart:fd = open("some_filename", "r") fd.seek(-2, os.SEEK_END) #same happens if you exchange the second arg…

When is a variable considered constant in terms of PEP8 naming styles?

In keeping with PEP8 conventions, in a .py I can define constants as:NAME = "Me" AGE = "Old" GENER = "Male"If a .txt contained Me Old Male on a single line, and in anothe…

Average Date Array Calculation

I would like to get the mean of the following dates. I thought about converting all the data to seconds and then averaging them. But there is probably a better way to do it.date = [2016-02-23 09:36:26,…