This repository contains the code for my personal blog website built with Django and Tailwind CSS.
Clone this repository by running the following command in your terminal:
git clone [email protected]:sulejmanhoxha/django-my-blog.git
Make sure you have Python 3.10.5 and pip 23.0.1 installed on your computer. Then, create a virtual environment by running the following command:
All the following commands are for Linux:
cd django-my-blog/
python3 -m venv .venv
source .venv/bin/activate
Install the required packages by running the following command:
pip install -r requirements.txt
Finally, run the server with the following command:
python3 manage.py runserver
You should now be able to access the blog website at http://localhost:8000/.
This project offers three main links for you to interact with it:
- Landing page: http://localhost:8000/ - the main landing page for the visitors of the website
- Admin: http://localhost:8000/admin/ - for the administrators of the website. It allows managing of the website's content
- API : you can access the api through these two links:
- http://localhost:8000/api/blogs/ - shows the blogs as a JSON
- http://localhost:8000/api/comments/ - shows the comments as a JSON
This project uses Tailwind CSS for styling and it should run without having it installed. If you want to modify the project's look you need to install Tailwind CSS. To do that open up a new terminal window or tab and run the following commands:
npm install
npm run watch
If you have problems with the database, delete the db.sqlite3 file and run the following commands:
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py loaddata database_data.json
Here's a brief overview of the project structure:
./blog/ # Contains the Django app for the blog
./base/ # Contains the Django project settings
./static/ # Contains static files (CSS, JS, images, etc.)
./templates/ # Contains the HTML templates
./db.sqlite3 # SQLite database file
./manage.py # Django management script
./README.md # This file
./requirements.txt # Required Python packages
./tailwind.config.js # Tailwind CSS configuration file
./package.json # Contains project dependencies for Node.js
./package-lock.json # Lock file for project dependencies for Node.js
If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request.