Dear Diary is a web application built using Django that allows a single user to create and manage personal diaries.
The users can create new entries, view and edit existing entries, and delete entries that are no longer needed.
The app is built using Django templating language and uses MySQL as the database.
To install and run the application, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/TheBuffMinashi/Dear-Diary-Django-Web-App.git
- Install the required packages using pip:
pip install -r requirements.txt
- Create a new MySQL database for the app.
- There is a file named
.env.sample
in the project's root directory. Change it's name to.env
and complete the necessary variables:
SECRET_KEY = (Django secret key)
MYSQL_DATABASE = (name of the mysql database)
MYSQL_USER = (name of the mysql user)
MYSQL_PASSWORD = (password for mysql user)
DB_PORT = (desired prt for mysql - default is 3306)
- You can generate a Django secret key from this website.
- Run the migrations to create the necessary tables in the database:
python manage.py makemigrations
python manage.py migrate
- Create a superuser for the app:
python manage.py createsuperuser
Follow the prompts to enter a username, email address, and password for the superuser.
- Start the development server:
python manage.py runserver
If you want to run the app on a specific port, you can run:
python manage.py runserver 127.0.0.1:PORT NUMBER
replace PORT NUMBER
with the desired port number.
If you are not willing to install the dependencies on your system, you could easily build and run the project's docker container with 2 simple commands.
- Clone the repository to your local machine:
git clone https://github.com/TheBuffMinashi/Dear-Diary-Django-Web-App.git
- Before building the containers, You need to complete the
.env.sample
file and change it's name to.env
:
SECRET_KEY = (Django secret key)
MYSQL_DATABASE = (name of the mysql database)
MYSQL_USER = (name of the mysql user)
MYSQL_PASSWORD = (password for mysql user)
DB_PORT = (desired prt for mysql - default is 3306)
PORT = (desired port number)
MYSQL_ROOT_PASSWORD = (password for mysql root user)
- Now you can build and run the containers:
docker-compose build
docker-compose up
You can access the application by heading to localhost:PORT
in your browser. PORT
is the same as the one in .env
file.
To use the application, follow these steps:
- Log in with your superuser account.
- Once logged in, you will be taken to the diary homepage where you can view all of your diary entries.
- To create a new entry, click the "New Entry" button and fill out the form with your desired title and content.
- To view an existing entry, click on the entry title in the diary homepage.
- To delete or edit an entry, click on the entry title in the diary homepage and then click the "Delete" or "Edit" button.
Here are some ideas for future improvements to this diary app:
- Add a page for your most recent entries.
- Give every weekday a color.
- Show the creation date in the HTML
<title>
tag. - Create an emoji of the day selection for an entry.
- Paginate the list of entries.
Feel free to fork this project and implement any of these ideas or come up with your own. If you make any changes, please submit a pull request so that others can benefit from your improvements.
Contributions to this project are welcome! If you have any suggestions or feature requests, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
This project was developed by Minashi, inspired by the tutorial Build a Personal Diary With Django and Python from Real Python. I would like to express my gratitude to the Django project for providing the powerful web framework that made this app possible.