How do i access pythonanywhere database?

Rommel Sotto

unread,

Sep 25, 2015, 1:08:12 PM9/25/15

to Sahana-Eden

I am having this error when loading eden

I created the mysql databas in pythonanywhere and I did this setup in 000_config

settings.database.db_type = "mysql"

settings.database.database = "test$Sahana"

settings.database.username = "testusername"

settings.database.password = "a0b3c1d9ef"

Thanks

Pat Tressel

unread,

Sep 26, 2015, 2:45:11 AM9/26/15

to

Let me make sure I understand...  Is this what you've done so far?

-- Got an account on Pythonanywhere with username "test".

-- Created a Web2py service.

-- On the MySQL tab, entered database name Sahana (after the test$ that they put in by default), and the database username and password you chose.

-- Installed a copy of Eden into Web2py's applications directory.

-- Edited the configuration file.

-- Tried to start Eden.


Could you comment out the settings.database.host line and try again?  The Pythonanywhere instructions for MySQL show an example for Django that has no host specified, so it seems the database can be accessed as though it is on the same machine.

Did you see instructions that say the database is on a remote server?

-- Pat

Pat Tressel

unread,

Sep 26, 2015, 5:34:40 AM9/26/15

to

Rommel Sotto

unread,

Sep 26, 2015, 11:45:29 PM9/26/15

to Sahana-Eden

Pat Tressel

unread,

Sep 27, 2015, 10:47:30 AM9/27/15

to

Thanks that fixed it.

-- Pat

Pat Tressel

unread,

Sep 27, 2015, 11:57:56 PM9/27/15

to

Say, I'm wondering...how do you like Pythonanywhere?  I only know two people who've used it to run Eden.  They were just trying it out, and had the free accounts, which have resource limits.  Have you got a regular (paid) account? and does the performance seem ok?  Are you thinking of using it for a production system?

The two other folks also just used SQLite.  So I'm also wondering if you'd be willing to add a section to our wiki page about how to set up MySQL:

http://eden.sahanafoundation.org/wiki/InstallationGuidelines/PythonAnywhere

Any corrections or improvements to the other instructions would be very welcome, too!

;-)

-- Pat

Rommel Sotto

unread,

Sep 28, 2015, 2:30:50 AM9/28/15

to Sahana-Eden

Hi Pat

So far so good with pythonanywhere, easy to setup very straightforward (I can say because I have no background in IT whatsoever). I am running two Eden there, one I use as a production server, mostly using staff, warehouse and project module, though it will not be that much traffic since we are only about 10 people using it, and most of them are just viewing things only when needed (Bosses). The other I use to test things out mostly before I import data, or switch on and off functionality that I want before making the changes in the production server.

Regarding the wiki page I think I can come up with something though it will be very specific to how I setup the pythonanywhere MSQL as again I have no IT background most of which I just asked question and do some google search.

Thanks

Louiqa Raschid

unread,

Sep 28, 2015, 2:46:07 AM9/28/15

to Sahana-Eden

Rommel - Hi. You would be a great candidate to evaluate Pythonanywhere since we are indeed looking for solutions for non-developers who have NO or LIMITED background in Python. If you put together some instructions re: the basic installation I am happy to edit as needed. You will see that the current installations mentioned by Pat do not really discuss connecting to the MySQL database and that is the step where others may also encounter problems. It will be GREAT if you can help. Louiqa Raschid

Rommel Sotto

unread,

Sep 28, 2015, 5:12:34 AM9/28/15

to

Hi

I did some edits in the wiki page, kindly check.

One thing is it normally work for new installation, but when I tried it with an Eden that has already an admin account and some data it gives this error 

(1452, 'Cannot add or update a child row: a foreign key constraint fails (`rommelsotto$edentest`.`auth_event`, CONSTRAINT `auth_event_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) ON DELETE CASCADE)')

The solution I have is to delete the sessions folder.

Thanks

How do I connect to a PythonAnywhere database?

Set "Destination" to yourusername . mysql.pythonanywhere-services.com:3306 . Click the "Open" button, and enter the username and password you would use to log in to the PythonAnywhere website. Once it's connected, leave PuTTY running -- it will manage the SSH tunnel.

Does PythonAnywhere have database?

Databases available There are three databases built in to PythonAnywhere: MySQL, which is available for every user. SQLite, which is also available for everyone, but runs a bit slowly on our system -- we recommend you only use it for testing or for scripts that don't do a lot of processing.

How do I upload a database to PythonAnywhere?

Importing your local database to PythonAnywhere.
Open phpMyAdmin..
Select your database by clicking the database name in the list on the left of the screen..
Click the Export link. ... .
In the Export area, click the Select All link to choose all of the tables in your database..
In the SQL options area, click the right options..

How do I connect to a mysql database in python?

ORM way.
Use connect() method of mysql connector python to connect to MySQL. pass the required argument to connect() method. i.e. Host, username, password, and database name..
Create cursor object from connection object returned by connect() method to execute SQL queries..
close the connection after your work completes..