Skip to content

Meirna-kamal/wagtail-project

Repository files navigation

Wagtail Project

Project Overview

Multi-Language Home Page

  • The website supports multiple languages.
  • The home page contains three sections: Image Slider, Vision, and News.
  • Each section is implemented using Wagtail's StreamField and custom blocks.

News Page with Image Gallery and Pagination

  • A NewsPage is implemented to display news articles with images.
  • News articles are paginated.
  • All news content is managed via the Wagtail admin interface.

Dynamic Header and Footer Navbars

  • The header and footer navigation bars are dynamic.
  • You can select any page from the Wagtail admin and assign it a custom title for the header or footer.

Setup Instructions

Follow these steps to set up the project locally:

1. Clone the Repository

Clone the repository from GitHub:

git clone https://github.com/Meirna-kamal/wagtail-project.git
cd wagtail-project

2. Create a Virtual Environment

Ensure you have Python 3.9 installed. Then, create a virtual environment:

python -m venv venv

Activate the virtual environment:

  • On Windows:
venv\Scripts\activate
  • On macOS/Linux:
source venv/bin/activate

3. Install Dependencies

Once the virtual environment is activated, install the required dependencies:

pip install -r requirements.txt

4. Apply Database Migrations

Ensure you have Python 3.9 installed. Then, create a virtual environment:

python manage.py makemigrations
python manage.py migrate

5. Create a Superuser

Create an admin account for accessing the Wagtail admin panel:

python manage.py createsuperuser

6. Run the Development Server

Start the development server:

python manage.py runserver

Linting

1. How to Run Ruff Linting

To run Ruff linting on your project, execute the following command:

ruff check .

2. Ruff Configuration and Rules

The project uses Ruff for linting with the following configuration:

  • Target Python Version: The linting is configured for Python 3.9.
  • Line Length: The maximum allowed line length is set to 79 characters.

Linting Rules

  • Types of Issues Selected:
    • Errors (E): Critical issues that need to be fixed.
    • Warnings (W): Potential problems that should be addressed.
    • Style and Formatting Issues (F): Problems related to code style and formatting.
    • Complexity Issues (C): Concerns about the complexity of the code.

Excluded Files

Certain files are excluded from linting because they are auto-generated by Django and typically do not require manual linting:

  • wagtail_project/settings/production.py
  • wagtail_project/settings/dev.py
  • wagtail_project/settings/base.py
  • manage.py

How to Set Up Content in Wagtail

1. Log In to Wagtail Admin

  • Access the Wagtail admin interface.

2. Edit the Original Home Page

  • Navigate to the HomePage and insert the sections:
    • Image Slider Section: Allows multiple images.
    • Vision Section: Requires an image, title, and text.
    • News Section: Requires an image, title, and text.
  • Note: Only one type of each section is allowed.

3. Create a News Page

  • Add a new NewsPage as a child page under the Home Page.
  • Title the page News Page.
  • It will be accessible through the URL path /news-page/.

4. Enable Spanish Translation

  • Go to SettingsLocales.
  • Click Add a Locale and select Spanish.
  • Click Save to add the Spanish locale.

5. Translate the Home Page

  • After enabling Spanish translation, you will have the option to translate the Home Page.
  • Provide the Spanish translation for all content on the Home Page.

6. Add Header & Footer Menus

  • Go to the Snippet section in Wagtail.
  • Create Header & Footer menus.
  • Add the desired pages to the header and footer menus as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published