yvonnezoe
Posts: 127
Joined: Thu Feb 14, 2013 2:10 am
Contact: Website

Accessing MySQL database

Sat Mar 15, 2014 10:19 am

hey guys, i would like to seek your opinion on this as I have little idea about the whole structure and not sure where to find more information.

Currently I have this problem of having both Apache2 and CherryPy web server on my Raspberry Pi.
Apache2 is at port 80 and CherryPy is at port 8080.
I have a camera app (http://raspberrypiwonderland.wordpress. ... amera-app/) deployed at all time at port 80 -> http://localhost
However I have a few servo motors and LEDs that are controlled by the GPIO from the web app. The web app is deployed using CherryPy at port 8080, such as this http://raspberrypiwonderland.wordpress. ... y-web-app/.
I have also installed php and mysql together with Apache2. I have a few problems here:

1. The camera display is at http://localhost but the "servo controller button" to move the camera left and right is at http://localhost:8080. How to put them together under the same page?

2. I can access phpmyadmin from http://localhost/phpmyadmin but not http://localhost:8080/phpmyadmin. But I have a form to link to the database from the cherrypy app at port 8080.

3. I would like to use the data from the database to determine the servo movement. eg, get a number from a field to determine how many times the servo has to repeat a certain movement (action of dispensing a pill). How possible is this?

My camera app files are in /var/www while cherrypy app is in its own directory. I have thought of a few ideas here. Please give me your feedback on which one is the easiest because i have limited time constraint to finish this project (1 week) .
1. get rid of cherrypy. But how can i run the python file from a html? I tried several methods and ppl were suggesting Flask, which turn out worst than cherrypy.
2. access database from camera app (http://localhost)
3. i read something about WSGI for cherrypy but i dunno if it is suitable for my case? I dont really know what is it for?

I have very limited knowledge about all these web servers thing but hope to learn all the necessary things in the shortest time possible. I hope to hear some opinions from you guys. thanks a lot! :D
Just started my Raspberry Pi journey >> http://yvonnezoe.wordpress.com

KeithSloan
Posts: 321
Joined: Tue Dec 27, 2011 9:09 pm

Re: Accessing MySQL database

Sat Mar 15, 2014 7:49 pm

To answer question 1) I would put both links in different frames on the same page

yvonnezoe
Posts: 127
Joined: Thu Feb 14, 2013 2:10 am
Contact: Website

Re: Accessing MySQL database

Sun Mar 16, 2014 1:28 am

KeithSloan wrote:To answer question 1) I would put both links in different frames on the same page
Thanks! Do you mind explaining more? Like how I can get 2 pages from different port into just 1 page? Any clue on how to do it?
Just started my Raspberry Pi journey >> http://yvonnezoe.wordpress.com

Return to “Networking and servers”