Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
JavaScript console.error redirect to file in Daphne Django application

I am using systemd (on Debian) to launch a shell script (as me as a user):

startup.sh:

#/bin/bash
daphne -b '0.0.0.0' -p 8000 myProject.asgi:application 2> /tmp/log.out

In my Python (Django) application I need to output to stdout and have it show up on the screen (tty1), which is working fine. The problem is that the JavaScript console.error() messages are also showing up on the screen even though I am redirecting stderr when launching Daphne. Is there an easy way to have the JavaScript stderr also redirect to a file? (could be the same or a different file than /tmp/log.out)

My systemd service config is:

[Unit]
Description=Run my Django test server
DefaultDependencies=no
Requires=getty@tty1.service

[Service]
User=pi
Type=simple
WorkingDirectory=/opt/myModule
ExecStart=bash /opt/myModule/startup.sh
Restart=always
RestartSec=5
StandardOutput=tty
StandardError=journal
TTYPath=/dev/tty1
TTYVHangup=yes
TTYReset=yes

[Install]
WantedBy=basic.target
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The extra logging was coming from Daphne. I was able to redirect it to a log file by adding the --access-log flag:

daphne --access-log /tmp/daphne.log -b '0.0.0.0' -p 8000 myProject.asgi:application 2> /tmp/log.out

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!