personal blog to write and publish articles on various topics. The Web is built with Django and uses MySqLite as the database for data storage.
Credits of idea for: https://roadmap.sh/projects/personal-blog
- Post Management: CRUD (Create, Read, Update, Delete) operations for blog posts.
- Simple Auth: The views post management only avaible for Admins, guest only watch post.
- Python 3.13
- Django 5.1.4
- MySqLite
To run the app, ensure you have Python installed and follow these steps:
- Clone the repository:
git clone https://github.com/Alxcccc/personal-blog.git
cd personal-blog
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
- Install the dependencies:
pip install -r requirements.txt
- Configure Environment Variables:
- Create a .env file: Inside core directory of your project, create a file named .env and add the following lines (you will replace your_generated_secret_key later):
SECRET_KEY='your_generated_secret_key'
DEBUG=True
- Instructions to Generate a New Secret Key: Users can generate a new secret key by creating a temporary Python script, for example, generate_secret_key.py, and adding the following code:
from django.core.management.utils import get_random_secret_key
print(get_random_secret_key())
- Then, they should run this script from the terminal:
python generate_secret_key.py
- The generated secret key will be displayed in the console. Users should copy this key.
- Update the .env File: Users should paste the copied secret key into their .env file, replacing your_generated_secret_key:
SECRET_KEY='new_generated_key'
DEBUG=True
- Set up the database:
- Apply database migrations to set up the database schema:
python manage.py migrate
- Create a Superuser (Optional): If you need access to the Django admin interface, create a superuser account:
python manage.py createsuperuser
Run the Development Server:
- Start the development server:
python manage.py runserver
- Access the application by navigating to http://127.0.0.1:8000/ in your web browser.