syntax usage for the Database name ??

22 views
Skip to first unread message

Eran Ariel

unread,
May 14, 2014, 7:38:38 AM5/14/14
to django...@googlegroups.com

Hi,

 

I am uncertain as to the proper syntax usage for the Database name.

I have a MYSQL database called "test". Does the subsequent script automatically point to the folder where mysql databases reside on my Ubuntu machine?

 

os.path.join(BASE_DIR, 'db.test ')

 

Furthermore, the instructions as per the Django site are to provide the full path where the database resides… However, I am again uncertain whether that refers specifically to all databases and how to apply it in proper syntax

 

Can someone provide me with a configuration example?

 

 

Thanks in advance

 

Eran Ariel

Ramiro Morales

unread,
May 14, 2014, 8:43:32 AM5/14/14
to django...@googlegroups.com
If you are using a RDBMS like mysql, or any of them different from
sqlite3 then in the NAME value you should simply specify the name of
the database in which you want Django creates the tables for the apps
of your project.

Per https://docs.djangoproject.com/en/1.6/topics/install/#get-your-database-running
and https://docs.djangoproject.com/en/1.6/intro/tutorial01/#database-setup,
that database should have been created previously using the MySQL
administrative tools and the user you plan to use should have the
right permissions on it.

sqlite3 is special in the sense that it is a embeddable library (as
opposed to a RDBMS). That's why you need to specify the file system
path to the file the library will create the first time. No need to
provide USER/PASASWORD credentials because that's another feature it
doesn't provide.

With a RDBMS you connect to it possibly through the network and use
SQL to handle tables. It is in charge of handling low level details
like which files(s) it is using to store your data.

An example DATABASES setting value (for postgres)::

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': '',
'NAME': 'django_test_suite',
'USER': 'ramiro',
'PASSWORD': '123',
},
'other': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': '',
'NAME': 'other',
'USER': 'ramiro',
'PASSWORD': '123',
}
}

HTH

--
Ramiro Morales
@ramiromorales

Eran Ariel

unread,
Jun 14, 2014, 12:24:07 PM6/14/14
to django...@googlegroups.com
Ramiro,

Thank you so much for your reply... apologies for the late response
Reply all
Reply to author
Forward
0 new messages