This is an example Django application that uses MySQL as the database backend. It provides a simple web interface to manage a list of books.
-
Clone this repository
-
Install Python 3.x and MySQL
Create a virtual environment and activate it:
python3 -m venv env source env/bin/activate Install the Python dependencies:
Copy code pip install -r requirements.txt Create a MySQL database and user:
mysql -u root -p CREATE DATABASE django_mysql_example; CREATE USER 'django'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON django_mysql_example.* TO 'django'@'localhost'; FLUSH PRIVILEGES; Create the database tables:
python manage.py migrate Usage Start the Django development server:
python manage.py runserver Open a web browser and go to http://localhost:8000//
Use the web interface to add, edit, or delete books.
Configuration The database settings are configured in the settings.py file. By default, this application uses the following settings:
python Copy code DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'django_mysql_example', 'USER': 'django', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': '', } } You can change these settings to match your MySQL database configuration.
License This project is licensed under the MIT License - see the LICENSE file for details.