1

I've been trying to set up my Django project with MAMP for hours,, but still having problem understanding what's going on..

So what I've been doing is:

-First, obviously I installed all the necessary packages (ex. mysql, mysql-python, etc)

-I changed the MAMP's Apache Document Root to Django project folder (/MyDjangoProjects/Sample_Project/)

-I changed the Sample_Project's setting.py to:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'samleprojectdb',            
        'USER': 'root',
        'PASSWORD': 'password1',
        'HOST': '/Applications/MAMP/tmp/mysql/mysql.sock',
        'PORT': '',
    }
}

-Finally, I ran the Apache and MySQL servers with MAMP and navigated localhost:8888

So I guess basically theses are all the necessary steps that I need to take...

I expected that navigating the page localhost:8888 will direct to my project's main page view (index.html), as I configured in urls.py. However, it just opens an "Index of /" page containing the directories and python files in my local directory. I know MAMP is intended to be used with PHP and to look for index.php, but I thought it should work with Django projects as well..

1. Is there something else I need to do to test Django projects with MAMP??? Thanks...

2. Also, where is the database file "sampleprojectdb" created???? When I used sqlite instead of mysql, the database file was automatically created in the project directory when I ran "python manage.py syncdb"

user2492270
  • 2,215
  • 6
  • 40
  • 56

1 Answers1

0

The host expects the address of the machine that runs the mysql server,like localhost or an IP of the system that runs the DB server.

Also,Use blank for localhost..

About where the database is created,if you mean the files,they are at /var/lib/mysql,but they wont be of much use.syncdb creates the database with the specified configuration.

Also, to run django with apache you will have to setup apache to run the wsgi daemon.

You can try your application using the development server by python manage.py runserver

rjv
  • 6,058
  • 5
  • 27
  • 49