My personal journal on software development and practical programming.
Friday, September 5, 2014
Django with Python 3 and MySQL database
I read many folks are having problems using MySQL db driver with Python 3, especially when setting up a Django app. The default Django 1.6.5 is only supporting the MySQLdb driver and that only works with Python 2.
I have been using mysql-connector-python package with Python 3 and it has built-in django support as well. I had ran into trouble like this http://bugs.mysql.com/bug.php?id=73232, but it is fixed now with the latest mysql-connector-python 1.2.3 release. The mysql-connector-python also works with Python 2.7 as well, and it's a pure python library without native code, which makes the install much easier.
When installing mysql-connector-python, ensure you allow external hosted files like this
pip install --allow-all-external mysql-connector-python
If you are behind a firewall, use the proxy option
pip install --proxy my_proxy_server --allow-all-external mysql-connector-python
With these, now you can set your Django settings.py file with MySQL engine
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'mydb',
'USER': 'myuser',
'PASSWORD': 'mypassword',
}
}
PS: My initial testing with Django 1.7 also works pretty well with mysql-connector-python. How sweet!
UPDATE 07/15/2015:
The django 1.8 documentation now recommends using 'mysqlclient' package if you want to use Python3 with MySQL backend. It should be a drop in replacement for 'MySQLdb'.
Subscribe to:
Post Comments (Atom)
Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
ReplyDeleteThis article resolved my all queries.
PHP Training in Chennai | Certification | Online Training Course | Machine Learning Training in Chennai | Certification | Online Training Course | iOT Training in Chennai | Certification | Online Training Course | Blockchain Training in Chennai | Certification | Online Training Course | Open Stack Training in Chennai |
Certification | Online Training Course
Thank you so much for sharing such an awesome blog.
ReplyDeleteMysql Tutorial
You need to take part in a contest for one of the best sites on the net. I most certainly will recommend this blog!
ReplyDeleteIamlinkfeeder
ReplyDeleteIamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Iamlinkfeeder
Django with Python 3 and MySQL database a useful blog for the learner, Working and experienced as well. Thanks for sharing
ReplyDeletePython Training in Pune
Django with Python 3 and MySQL database a useful blog for the learner, Working and experienced as well. Thanks for sharing. Python Classes in Pune
ReplyDeleteaşk kitapları
ReplyDeleteyoutube abone satın al
cami avizesi
cami avizeleri
avize cami
no deposit bonus forex 2021
takipçi satın al
takipçi satın al
takipçi satın al
takipcialdim.com/tiktok-takipci-satin-al/
instagram beğeni satın al
instagram beğeni satın al
btcturk
tiktok izlenme satın al
sms onay
youtube izlenme satın al
no deposit bonus forex 2021
tiktok jeton hilesi
tiktok beğeni satın al
binance
takipçi satın al
uc satın al
sms onay
sms onay
tiktok takipçi satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
instagram beğeni satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
takipcialdim.com/instagram-begeni-satin-al/
perde modelleri
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
I think you should lead youtube or tiktok profile to publish your video about code. From here https://soclikes.com you can get many likes to promote your video
ReplyDeleteNice blog online assignment help Montreal
ReplyDeleteHere is the best Software training institute to study AWS training in Chennai, from Infycle Technologies and we come up with courses like Cyber Security, Graphic Design and Animation, Block Security, Java, Cyber Security, Oracle, Python, Big data, Azure, Python, Manual and Automation Testing, DevOps, Medical Coding etc., with outstanding training with experienced trainers and a friendly environment with 100+ Live Practical Sessions and Real-Time scenarios. After completion of the course a student will be able to obtain more knowledge of the course and be able to crack interviews on top MNC’s. For more queries dial 7504633633 or 7502633633.
ReplyDeleteIn this day, it seems like everyone is advertising themselves as a digital marketing agency. But how do you know which one to choose?
ReplyDeleteIt would help if you considered many things when selecting the best digital marketing agency for your brand or company.
The following article will provide 5 tips on finding the top financial planners digital marketing agencies to help you make an informed decision and ensure for your business ideas goals!
thanks due to the fact you have been precise-natured to percentage opinion subsequent to us. we are able to continually recognize all you have finished here because I understand you are selected worried thinking about our.! Users can save their personalized presentations locally and online into their accounts using this software. Download Prezi Full Crack
ReplyDeletei'm able to see which you are an capable at your pitch! i'm launching a internet site quickly, and your inform could be very useful for me.. thanks for all your benefit taking place and wishing you all the triumph for your issue.! Microsoft Office 2010 Carck
ReplyDeleteWe current you a extensive selection of good night messages for him that you simply may send. Good Night Wishes For best Friends words and phrases will gladden these people Good Night Wishes For Friends
ReplyDeleteIt is one of the best blog sites. I was really impressed to read this blog.
ReplyDeletereckless driving in virginia
conducción imprudente en virginia
divorce law in virginia
Abogado de Accidente de Motocicleta en San Bernardino
ReplyDeleteThank you for your great article and please keep writing them.
ReplyDeletehttps://macapps-download.com/switchresx/
ReplyDeleteI love it...! This is very nice and keep sharing the valuable content with us...
Best Family Lawyer for Dads
Child Support Virginia
Thanks for sharing this contents
ReplyDeletebankruptcy lawer near me
bank ruptcy lawyers near me
Best indian students database providers At Best Price
ReplyDeleteelf bar
ReplyDeletebinance hesap açma
sms onay
6DUZ
betmatik
ReplyDeletekralbet
betpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
N71T
شركة عزل اسطح بجدة
ReplyDeleteشركة مكافحة حشرات بجدة
Thank you so much for compiling such a great article! Clearly, this is an excellent post. I appreciate the insightful and useful information you have offered here. custom erp software
ReplyDeleteçekmeköy
ReplyDeletekepez
manavgat
milas
balıkesir
7DDDF
bayrampaşa
ReplyDeletegüngören
hakkari
izmit
kumluca
5TJH
burdur
ReplyDeletebursa
çanakkale
çankırı
çorum
denizli
diyarbakır
TP276
Nice blog " I Love your writing style! How you [describe/explain] makes the content engaging and easy to follow."
ReplyDeleteJava full stack training institute in KPHB
Superb Post. Thanks for the post.
ReplyDeletealso, check >Python training in Pune
Join top-rated React Training in Hyderabad to boost your web development skills. Interactive sessions, real-world projects, and expert instructors. Enroll now.
ReplyDeleteExcellent article. It is Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.
ReplyDeleteUI UX Design School in Pune is committed to providing high-quality education that's accessible to students from all backgrounds. Here's a breakdown of the key features and benefits of your UI/UX design course:
ReplyDeleteIndustry Expertise: Your courses are taught by industry experts who possess real-world experience in UI/UX design. This ensures that students receive practical insights and relevant knowledge that can be applied directly to their careers.
Accessible Teaching Methods: Your instructors strive to make the learning process easy and comprehensible for every student. By employing various teaching methods and techniques, they ensure that all students can grasp the concepts effectively.
https://www.uiuxdesignschool.in/
A huge round of applause to the writer for tackling such a complex subject! Your ability to break it down into manageable pieces really helped me grasp the concepts better. I can't wait to read more of your work!
ReplyDeleteVisit our link for ISO Certification in Muscat
شركة مكافحة حشرات بالاحساء Clu2hITSYM
ReplyDelete