I need help
luigui789
FREEOP

8 months ago

Well, I wanted to deploy, and everything seems fine. I was following a guide, but I got to a point where when I tried to commit and start the deployment, I got an error that I've been trying to resolve for hours:

File "/opt/venv/lib/python3.12/site-packages/channels/layers.py", line 155, in require_valid_channel_name

raise TypeError(self.invalid_name_error.format("Channel"))

TypeError: Channel name must be a valid unicode string with length < 100 containing only ASCII alphanumerics, hyphens, underscores, or periods.

I hope you can help me.

Project: Django, CSS, HTML, JS, and now

I've also implemented websockets for a shifts section.

$10 Bounty

3 Replies

alexwebgr
HOBBY

8 months ago

hi there

does your channel name abide by those rules?

Channel name must be a valid unicode string with length < 100 containing only ASCII alphanumerics, hyphens, underscores, or periods.


luigui789
FREEOP

8 months ago

Yes, I actually have a feature for that.

import re

def safe_channel_name(original_name):

if not original_name:

return None

try:

name_str = str(original_name).strip()

safe_name = re.sub(r'[^a-zA-Z0-9\-_.]', '_', name_str)

safe_name = safe_name[:99]

return safe_name if safe_name else None

except Exception:

return None


alexwebgr
HOBBY

8 months ago

what does actually output though?


Loading...