Comments (12)
Is the /{app_name}/
a literal?
from daphne.
{app_name} is not a literal. It is pseudo-code for the name of the app on the path.
from daphne.
OK, then I'm not sure what to say.
This works AFAICS:
% daphne -u app.socket app:application
... so it's something particular about your setup.
from daphne.
I tried ExecStart=/usr/bin/python3 /usr/bin/daphne -u socket {app_name}.asgi:application
I get back:
CRITICAL Listen failure: [Errno 22] Invalid argument: b'socket.lock'
Yes, it's something particular about my setup. Most likely it's the implementation of twisted on debian 12 vs. daphne. Twisted use to be python2. It appears to be a mismatch in argument passing between a bytestring and a utf8 one. For some reason the daphne looks like it's passing the file socket parameter as a bytestring to twisted when it should be passing it as utf8
from daphne.
When I do:
/usr/bin/python3 /usr/bin/daphne -u socket.lock {app_name}.asgi:application
(add the .lock extension to the unix file...), I get:
2024-02-07 19:42:43,032 INFO Starting server at unix:socket.lock
2024-02-07 19:42:43,033 INFO HTTP/2 support enabled
2024-02-07 19:42:43,033 INFO Configuring endpoint unix:socket.lock
2024-02-07 19:42:43,033 CRITICAL Listen failure: [Errno 13] Permission denied: '276285' -> b'socket.lock.lock'
So based on that doubling-up of the lock extension in the log, it appears I should not include it...
from daphne.
Also tried quoting the socket file argument; same error...
/usr/bin/python3 /usr/bin/daphne -u "socket.lock" {app_name}.asgi:application
from daphne.
Does it work if you run Daphne manually rather than via systemd?
(To be honest, without a reproduce I'm going to struggle to help you )
from daphne.
I did try it interactively in the context of the username the service uses and the WorkingDirectory -same error
from daphne.
I tried a random socket file name (that does not exist):
/usr/bin/python3 /usr/bin/daphne -u blah {app_name}.asgi:application
/usr/bin/python3 /usr/bin/daphne -u blah {app_name}.asgi:application
2024-02-07 20:12:32,346 INFO Starting server at unix:blah
2024-02-07 20:12:32,346 INFO HTTP/2 support enabled
2024-02-07 20:12:32,346 INFO Configuring endpoint unix:blah
2024-02-07 20:12:32,347 CRITICAL Listen failure: [Errno 13] Permission denied: '278322' -> b'blah.lock'
Got that permission error. When you have it reference a socket file that exists, has the service's user and group ownership, and rwx permissions for both the user and group, you still get that invalid argument error, showing that a bytestring is being passed
from daphne.
The socket file argument SHOULD be able to take a fully qualified path; and I tested that I can touch the socket file, so a permissions thing doesn't appear to be coming into play. It's saying the path is bad. Only thing I can come up with is that twisted is being passed a bytestring when it now expects utf8
from daphne.
What distro are you using?
from daphne.
You can examine the socket_description
here:
It's definitely a string type when it leaves Daphne. Whatever is going on beyond that is inside twisted.
from daphne.
Related Issues (20)
- issuse when i using daphe in my django app with streaminghttpresponse HOT 7
- Can daphne run WSGI apps? HOT 6
- Does daphne have a file for initialization?
- Requests with Transfer-Encoding: chunked have no content HOT 15
- StreamHttpResponse with sync operations break in Daphne HOT 5
- Memory usage: Daphne loading all the file in memory (POST request) HOT 7
- Text streaming buffered issue
- Implement WebSocket Denial Response extension HOT 8
- [feature request] trailing headers HOT 1
- Add support for Python 3.12
- DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 HOT 1
- Daphne with self signed ssl HOT 2
- Daphne allows invalid characters within header names HOT 7
- TypeError: object HttpResponse can't be used in 'await' expression HOT 3
- add support for --proxy-headers and friends in runserver HOT 4
- fd_endpoint.py is not properly installed HOT 7
- python manage.py runserver not working HOT 5
- Daphne - Twisted custom cipher list using set_cipher method HOT 3
- --noasgi won't serve static files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from daphne.