Search code examples
pythonmysqldjangodjango-settings

I can't change main Django project settings file


I was trying to configure the Django Database Settings to use mysql. I followed the instructions provided here

I started a Django project within the myproject directory.

django-admin.py startproject myproject .

I tried to open the main Django project settings file

nano ~/myproject/myproject/settings.py

And the terminal did not display a DATABASES section at the bottom of this file. Instead I had ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell

What do you recommend? I need to change this settings file to use mysql database.I have Ubuntu 14.04. and python 3.4. installed.


Solution

  • Possible reasons for your problem:

    1. This is not the correct path: ~/myproject/myproject/settings.py.
    2. Path is correct but you are facing issue using nano. Try using vim instead (if you are familiar with it). If not, try using any GUI editor.

    As you already mentioned, you are on Ubuntu -- open the terminal and type gedit to open the text editor. Now navigate to the settings file on your system.