This project is a News website developed using Django that allows users to view and read news in different categories. The site supports news categories, tags, search, number of views, comments and authors.
This project effectively showcases typical features and structures involved in creating similar services.
Key Features:
- View list of news articles with pagination
- Filtering news by categories and tags
- Detailed reading of the news on a separate page
- Commenting on news with the possibility of moderation
- Search articles by keywords
- Display of popular news
- Ability to view articles separately by category
- Show latest articles in slider
✨ To use it, you need to complete the following steps:
-
Clone this repository
git clone https://github.com/lazycatcoder/django-news-app.git
-
Open a terminal and navigate to the project 'django-news-app' folder
cd path/.../django-news-app
-
Create a virtual environment in the 'django-news-app' folder
python -m venv venv
-
Activate the virtual environment
source venv/bin/activate # MacOS/Linux venv\Scripts\activate # Windows
-
Install the following dependencies
pip install -r requirements.txt
-
Use the console to navigate to the 'django-news-app\news_app' folder
cd news_app
-
Make migration
python manage.py makemigrations python manage.py migrate
-
Сollect static files
python manage.py collectstatic
-
Navigate to folder 'django-news-app\news_app\news_app' and open the settings.py file.
The next step is to fill in some data in settings.py:
-
Generating a new SECRET_KEY in Django
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
This command will execute a Python script that imports the get_random_secret_key() function and calls it to generate a new key. The result will be printed in the terminal.
When you get the new key, copy it and paste it into settings.py instead of SECRET_KEY = ' ''
- Use the console to navigate to the 'django-news-app\news_app' folder and run the server
python manage.py runserver
- Open a browser and enter the following address to launch the project http://127.0.0.1:8000/ 🚀
🔴 to add, delete or edit: news, tags, categories, comments, you can use the Django admin panel (login: admin, password: admin) http://127.0.0.1:8000/admin/ or you can create a new superuser for this use the console to navigate to the 'django-news-app\news_app'
python manage.py createsuperuser