Configuring Django and MariaDB on CentOS 7

Submitted by aknnn on Mon, 10/01/2018 - 01:07

This tutorial will demonstrate how to install Django and MariaDB on CentOS 7

Preferably inside virtual environment execute:
pip3 install django

MariaDB is needed (If you want, you can use mysql instead)
for this you need to enable MariaDB repos.

Inside /etc/yum.repos.d/ create file MariaDB.repo with contents:

name = MariaDB
baseurl =
gpgkey =
gpgcheck = 1

Install required MariaDB packages:
yum install MariaDB-server MariaDB-client

django-admin startproject project_name
This will create a folder with the project_name to the current working directory.

install pymysql (Python MySQL connector)
pip3 install pymysql

Start MariaDB, login as root, create user, add database and add permissions to user (this user will be used to connect django to database):
systemctl enable mariadb <-- makes mariadb start at boot
systemctl start mariadb  <-- root user will be created, write your credentials down for later usage.
mysql -u root -p  <-- password will be prompted.

Now you should be logged in to mariadb shell as root user. Execute following commands:
CREATE DATABASE example_database;
CREATE USER 'example_username'@'localhost;
GRANT ALL PRIVILEGES ON example_database.* TO 'example_username'@'localhost' IDENTIFIED BY 'example_password';

Now you can quit mysql.

Edit project_name/project_name/ to include these lines:
import pymysql

Go to file in the same folder. Find DATABASES dictionary and edit it as follows:

    'default' : {
        'ENGINE'        : 'django.db.backends.mysql',
        'NAME'            : 'project_name',
        'USER'            : 'example_username',
        'PASSWORD' : 'example_password',
        'HOST'            : 'localhost',
        'PORT'            : '',

If gods are in our side, you should be able to run:
python3 runserver
if that passes, you can try to visit your server port 8000 with a web browser

if that doesn't go trough, theres probably something wrong with your firewall settings. Fix them and try again.


Submitted by Eulah (not verified) on Tue, 01/15/2019 - 02:54


This is the perfect web site for everyone who wants to find out about this topic.
You realize a whole lot its almost tough to
argue with you (not that I really would want to…HaHa).
You certainly put a new spin on a topic that has been discussed for
decades. Wonderful stuff, just great!

Review my web-site - Erektionsstörung (

Submitted by Hester (not verified) on Sat, 01/19/2019 - 22:43


Hey there would you mind letting me know which webhost you're
using? I've loaded your blog in 3 different browsers and I must say this blog loads a lot quicker then most.
Can you suggest a good hosting provider at a honest price?

Thanks, I appreciate it!

my web blog Judi Jackpot Online

Submitted by Bernd (not verified) on Mon, 01/21/2019 - 04:24


Does your website have a contact page? I'm having problems locating it but, I'd like to shoot you an email.
I've got some suggestions for your blog you might be interested in hearing.
Either way, great blog and I look forward to seeing it expand over time.

my webpage Judi Jackpot Online

Submitted by Otilia (not verified) on Tue, 01/22/2019 - 13:22


Greetings! Quick question that's entirely off topic. Do you know how
to make your site mobile friendly? My web site looks weird when browsing from my iphone.
I'm trying to find a template or plugin that might be able to fix this problem.
If you have any suggestions, please share. Many thanks!

Check out my blog post; Judi Jackpot Online

Submitted by Teresita (not verified) on Tue, 01/22/2019 - 16:14


When I initially left a comment I appear to have clicked on the -Notify
me when new comments are added- checkbox and now whenever a comment is added I get four emails with the same
comment. Is there a means you are able to remove me from that service?

Feel free to visit my webpage - Judi Jackpot Online

Submitted by Vanessa (not verified) on Wed, 01/23/2019 - 06:13


A person essentially assist to make severely posts I'd state.
This is the first time I frequented your web page and to
this point? I amazed with the research you made to make this particular submit incredible.
Magnificent task!

Feel free to surf to my webpage ... Judi Jackpot Online

Submitted by Jacinto (not verified) on Wed, 01/23/2019 - 12:15


This design is steller! You most certainly
know how to keep a reader entertained. Between your wit and your
videos, I was almost moved to start my own blog (well, almost...HaHa!) Excellent job.

I really loved what you had to say, and more than that, how you
presented it. Too cool!

Also visit my site :: Judi Jackpot Online

Submitted by Refugio (not verified) on Thu, 01/24/2019 - 22:25


With havin so much content do you ever run into any issues of plagorism or copyright violation? My
blog has a lot of unique content I've either written myself or outsourced but
it appears a lot of it is popping it up all over the internet without my agreement.
Do you know any solutions to help reduce content from being
ripped off? I'd truly appreciate it.

my page: Judi Jackpot Online

Submitted by Gilberto (not verified) on Sun, 01/27/2019 - 14:28


Hi! Quick question that's entirely off topic. Do you know how to make your site mobile friendly?
My blog looks weird when viewing from my iphone4. I'm trying to find a template
or plugin that might be able to correct this problem.
If you have any recommendations, please share. Appreciate

Also visit my site: Judi Jackpot Online

Submitted by Victoria (not verified) on Sun, 01/27/2019 - 22:31


You really make it seem so easy with your presentation but I find this matter to be actually something
that I think I would never understand. It seems too complicated and very
broad for me. I am looking forward for your next post, I will try to get the
hang of it!

my web site - Judi Jackpot Online

Submitted by Harlan (not verified) on Fri, 02/01/2019 - 16:05


Attractive part of content. I just stumbled upon your weblog and in accession capital to say that I get actually loved account your weblog posts.
Any way I will be subscribing for your feeds or even I
success you get right of entry to consistently rapidly.

my website Agen Poker (Victorina)

Submitted by Jessie (not verified) on Fri, 02/01/2019 - 21:13


I һave been exploring fοr a littⅼе bit for any hiigh
quality articles οr weblog poszts іn thhis sort of house .
Exploring іn Yahoo I ultimately stumbled սpon thіs website.
Reading tһis informatіon So i'm satisfied
tߋ exhibit that I've an incredibly excellent uncanny feeling I
discovered јust what I needed. І such a lot undoսbtedly wil make sᥙгe to don?t
overlook thіs site and рrovides it a glance regularly.

Ꮮook int᧐ my website ... velvet buzzsaw movie (Alycia)

Submitted by Kendra (not verified) on Mon, 02/04/2019 - 19:57


Just want to say your article is as astonishing. The clarity in your post is just nice and i can assume you are an expert
on this subject. Well with your permission allow me to grab your RSS feed
to keep updated with forthcoming post. Thanks a million and please continue the gratifying work.

my page; Poker88

Submitted by Jacquie (not verified) on Tue, 02/05/2019 - 14:04


Ηey jսst wanted to give you a brief heɑds up and let you know
a few of the pictuгes aren't loading properly. I'm noot sure why
but I think its a linking issue. I've tried it in two different browsers and
oth shoѡ tthe same outcome.

Rеѵіew my homepage :: Instagram hack

Submitted by Bradley (not verified) on Tue, 02/05/2019 - 17:40


I'm now not sure the place you are getting your information, however good topic.
I must spend a while learning more or understanding more.
Thank you for fantastic info I was in search of this info for my mission.

Feel free to visit my site: Chad

Add new comment