Apache Lounge


About Forum Index Downloads Search Register Log in  RSS Apache Lounge  

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.

Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Flask apache raspberry pi live streaming issue

Joined: 18 May 2018
Posts: 1
Location: Bangalore

PostPosted: Fri 18 May '18 18:34    Post subject: Flask apache raspberry pi live streaming issue Reply with quote

Hey guys,

I've hosted a simple Flask App on Apache webserver on a Raspberry Pi to stream real-time video from the PiCamera using tutorial from https://blog.miguelgrinberg.com/post/video-streaming-with-flask . Everything works fine locally for me and I can access my http://localip:5000 to get my live video feed. I now wanted to host this on a production server and I used Apache. I set all the configuration files and directory structures linked my Flask app and set the server for port 80. I visit the http://ip:80 and my webpage loads with a title, heading and static text but the video that is supposed to be below it is now a picture of a "broken image". Inspecting the webpage video element on the browser shows that the server returned nothing.

I saw another post Video Straming on raspberrypi using flask apche2and wsgi server, of a guy who ran into the same problem as mine. He marked an answer saying Apache wasn't having root access to the picamera and hence wasn't able to access it. I know that Apache runs as www-data group user and I don't know which folder/file I should give permissions so that it can access the PiCamera. I don't know how to go about from here.Locally using the inbuild flask dev web server everything is working perfectly but on serving through Apache the camera isn't capturing the images. Please help me. Here is my basic code and configurations (Flask app name is VideoStream):

Apache Configuration file:
<VirtualHost *:80>
                ServerAdmin realityreccode@gmail.com
                WSGIScriptAlias / /var/www/VideoStream/VideoStream.wsgi
                WSGIDaemonProcess VideoStream user=www-data group=www-data threads=5 home=/var/www/VideoStream/
        <Directory /var/www/VideoStream/VideoStream/>
                WSGIProcessGroup VideoStream
                WSGIApplicationGroup %{GLOBAL}
                WSGIScriptReloading On
                Order allow,deny
                Allow from all
                ErrorLog ${APACHE_LOG_DIR}/VideoStream-error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/VideoStream-access.log combined

The post at StackOverflow with more flask code https://stackoverflow.com/questions/50403464/raspberry-pi-live-video-streaming-with-apache-server-and-flask-app-works-in-deve Crying or Very sad
Back to top

Reply to topic   Topic: Flask apache raspberry pi live streaming issue View previous topic :: View next topic
Post new topic   Forum Index -> Other Software