JusticeEmpire JusticeEmpire - 3 years ago 153
MySQL Question

Would installing LAMP fix Django/MySQL config issues?

Excuse me for the very broad question, but I seem to be going around in circles.

I'm looking to build/develop a

application, using a MySQL database and host it on my RPi.

In trying to do so, I've learn that I need a webserver (apache2 seems to be the one these days) and that I needed to create an
to interface between them.

Initially, I was using Python and Qt to try and build an app to be the interface, but found out that things weren't simple and I used to use Python/MySQL connectors etc.

After a few weeks, I got things connected and then thought about the building of it. It became apparent that options like Flask & Django would be better suited for the task due to the frameworks.

I found the DjangoGurls tutorial simple to follow when I read through it, so decided to give it a go, and just had to work out to substitute their PythonAnywhere.com deployment example, with my own server..........stuck.

I've got things working on my laptop/development environment, but the server side of things isn't behaving. I know it's to do with the MySQL
but I can't pinpoint it.

There are so many different tutorials and commands to try, I've lost count, and so many seem to be out of date.

Then I found out about LAMP to add to my confusion, which sounds ideal if I had know about that at the start, but it doesn't include Django or Python, and I need (I think) PHP so I can use PHPMyAdmin to manage the MySQL.

Is it even possible to install LAMP on what I've already got?
Would it solve the server side MySQL issue?


I've managed to install pymysql, and when I try runserver I get a config parser error on

pip list
output is below (and I have no idea what most of them are):

automationhat (0.0.4)
blinker (1.3)
blinkt (0.1.0)
Cap1xxx (0.1.3)
chardet (2.3.0)
click (6.6)
colorama (0.3.7)
cryptography (1.7.1)
drumhat (0.0.5)
enum34 (1.1.6)
envirophat (0.0.6)
ExplorerHAT (0.4.2)
Flask (0.12.1)
fourletterphat (0.0.2)
gpiozero (1.4.0)
idna (2.2)
ipaddress (1.0.17)
itsdangerous (0.24)
Jinja2 (2.8)
keyring (10.1)
keyrings.alt (1.3)
lxkeymap (0.1)
MarkupSafe (0.23)
mcpi (0.1.1)
microdotphat (0.1.3)
mote (0.0.3)
motephat (0.0.2)
numpy (1.12.1)
oauthlib (2.0.1)
phatbeat (0.0.2)
pianohat (0.0.5)
picamera (1.13)
picraft (1.0)
piglow (1.2.4)
pigpio (1.38)
Pillow (4.0.0)
pip (9.0.1)
pyasn1 (0.1.9)
pycrypto (2.6.1)
pygame (1.9.3)
pygobject (3.22.0)
pyinotify (0.9.6)
PyJWT (1.4.2)
PyMySQL (0.7.11)
pyOpenSSL (16.2.0)
pyserial (3.2.1)
pyxdg (0.25)
rainbowhat (0.0.2)
requests (2.12.4)
requests-oauthlib (0.7.0)
RPi.GPIO (0.6.3)
RTIMULib (7.2.1)
scrollphat (0.0.7)
scrollphathd (1.0.1)
SecretStorage (2.3.1)
sense-emu (1.0)
sense-hat (2.2.0)
setuptools (33.1.1)
simplejson (3.10.0)
six (1.10.0)
skywriter (0.0.7)
sn3218 (1.2.7)
spidev (3.0)
touchphat (0.0.1)
twython (3.4.0)
urllib3 (1.19.1)
Werkzeug (0.11.15)
wheel (0.29.0)

Answer Source

The question was, would installing LAMP solve my MySQL/Django configuration issues, and the answer is no. Installing LAMP over the top would have made things more complicated.

1 - Installed PyMySQL rather than MySQLdb (mainly because I was struggling to install anything else.
2 - Setup MySQL with a my.cnf file (as per various guides) and after a bit of tweaking and fixing typos, that appears operational.
3 - Checked MySQL, and there is Django data in the relevant db/table

As far as I can see, Django is now using the MySQL database......

I now have to work out how to configure apache2 correctly, so that it can serve Django for me, without using a port number. I've hunted round and tried various tutorials/commands, no success yet, so will post another question.

Biggest advice - ALWAYS check the date of tutorials (or answers) on here and always try to use the most recent one. I've lost countless hours following tutorials that were out-of-date

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download