Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
how do you do this part using MySQL instead of the workspace? Please Help!
I am redoing this part of course using MySQL instead of workspace, but I'm having problems getting it to work. When i run the students.py file in the commander(command prompt), i get an error and suggest I need to install pyMySQL or MySQLdb; don't know if these two will work with MySQL workbench? I am using python 3.4.3, and MySQL workbench 6.3 don't know if that helps. Has anybody got it to work using MySQL? If so, what are the necessary steps.
Ryan Ruscett23,307 Points
I have done some DB stuff with Python and I usually go to MySql and I download the python connector
There is the link for you. On windows it takes some extra work so I would definitely not recommend using windows. I once created this program in Python in my windows environment and it took me like two weeks. Later I was like ohh dang I need to encrypt this stuff. Oh WAIT I can't on windows. At least the python libraries were not compiled so I needed to compile them on windows. PSH! Just exported the project into an eclipse on Ubuntu and kept going.
So if you only have windows, download OracleBox and get an ubuntu image and follow these instructions.
Ever since I had that issue I haven't used Python on windows. So I don't have any code or explicit directions for you. Sorry about that because I have asked for help so many times and I hate links lol.
I bumped into the same thing - the course uses Sqlite, but I wanted to use MySQL.
pip3 install peewee
peewee is a lightweight ORM
pip3 install pymysql
PyMySQL is a pure-python MySQL driver required by peewee to connect to a MySQL database
- Create new (empty) schema in your local MySQL instance called 'python_work' (or whatever)
- playhouse.db_url is installed with peewee, and we use its
connect()method to hook up to the database with the connection url shown
from peewee import * from playhouse.db_url import connect db = connect('mysql://user:password@localhost:3306/python_work')
I have connected my Flask app to mysql http://chdbfiletransferapp.tk and all i had to do was install the python mysql connector. Although I have only done it on a linux machine. sudo apt-get install python2.7-mysqldb.
Not sure about windows.
Hey guys, thanks for your input. Yeah, windows can be difficult sometimes which is my operating system. However I didn't realize python has sqlite3 already, don't know about the older versions, so I am going to stick with sqlite. Again thanks for the help.