Skip to main content

A CLI tool to scaffold Django + React projects with options for social login and styling frameworks.

Project description

Django-React-Jollof

Welcome to Django-React-Jollof! This package scaffolds a full-stack web application with Django for the backend and React for the frontend. It simplifies the setup process by automating the configuration, migration, and installation of necessary dependencies.

Tech Stack

  • Backend: Django, Django REST Framework
  • Frontend: React, Axios, Redux (optional)
  • Database: SQLite (default, configurable)
  • Authentication: Google login integration (optional)
  • Others: ESLint, Prettier, Vite (for fast React development)

Getting Started

Prerequisites

Ensure you have the following installed:

  • Backend:

    • Python 3.8+
    • pip
    • virtualenv
  • Frontend:

    • Node.js 20+ (recommended version)
    • npm or Yarn

Installation

  1. Install the Package

    Install the package via pip:

    pip install django-react-jollof
    
  2. Run the Setup Command

    After installation, use the django-react-jollof cook command to scaffold the project. This will:

    • Set up the Django backend.
    • Install frontend dependencies.
    • Run database migrations.
    • Set up social login configurations (if selected).
    django-react-jollof cook
    

    Follow the prompts to choose the frontend framework (Bootstrap or Material) and select social login providers (Google or none).

Environment Configuration

  • Backend: Configure environment variables by creating a .env file in the backend directory, optional, but recommended. For example:

    DEBUG=True
    SECRET_KEY=<your_secret_key>
    
  • Frontend: Update the .env file in the frontend directory to configure the API URL and any social login keys.

    Example:

    VITE_API_URL=http://localhost:8000/api
    VITE_GOOGLE_CLIENT_ID=<your_google_client_id>
    

Running the Application

  1. Start the Backend Server

    Ensure you're in the backend/ directory and your virtual environment is activated:

    cd backend
    source env/bin/activate  # For Linux/macOS
    # venv\Scripts\activate  # For Windows
    python manage.py runserver
    

    The backend will be available at http://localhost:8000.

  2. Start the Frontend Development Server

    In the frontend/ directory:

    cd frontend
    npm run dev
    

    The React app will be available at http://localhost:5173.


Authentication Setup

Social Login (Google, GitHub)

To enable social login functionality (Google), ensure you've configured the following in your .env files:

  • For Google:
    • Google Client ID and Client Secret from the Google Developer Console.

Optional: Using Social Login Providers

You can choose to enable Google or no social login methods during setup via environment variables. Modify the configuration in your .env files for both the backend and frontend to integrate them.

Example:

  • Backend .env:

    GOOGLE_CLIENT_ID=<google_client_id>
    GOOGLE_CLIENT_SECRET=<google_client_secret>
    
  • Frontend .env:

    VITE_GOOGLE_CLIENT_ID=<google_client_id>
    VITE_GITHUB_CLIENT_ID=<github_client_id>
    

Additional Features

  • Admin Dashboard: Django’s default admin panel for managing users and data.
  • Frontend Customization: Choose between Bootstrap or Material UI for the frontend.
  • API Integration: Django REST Framework is used for seamless API integration between the backend and frontend.
  • Cross-Origin Resource Sharing (CORS): Configured to allow the frontend to make requests to the backend from different domains.

Development Workflow

  • Backend:

    • Make changes to the backend code and use Django’s built-in features to manage migrations, users, and data.
    • Use the Django REST Framework for building and managing your APIs.
  • Frontend:

    • Make changes in the React components located in frontend/src/.
    • Use Vite for fast, hot-reload development in the React frontend.

Contribution

  1. Fork the Repository: Fork the repo to your GitHub account.
  2. Clone Your Fork: Clone the forked repository to your local machine.
  3. Create a Branch: Create a feature branch for your changes.
  4. Make Your Changes: Implement your feature or fix a bug.
  5. Commit Your Changes: Commit your changes with meaningful messages.
  6. Push Your Changes: Push your branch to your fork.
  7. Submit a Pull Request: Open a pull request to the main repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Conclusion

This README.md provides an easy-to-follow guide for setting up Django-React-Jollof as a package, including detailed steps for installation, running the backend and frontend, and configuring social login. The django-react-jollof cook command automates much of the setup process for you.

Let me know if you need further changes or additions!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_react_jollof-1.0.0.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_react_jollof-1.0.0-py3-none-any.whl (46.0 kB view details)

Uploaded Python 3

File details

Details for the file django_react_jollof-1.0.0.tar.gz.

File metadata

  • Download URL: django_react_jollof-1.0.0.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for django_react_jollof-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b0b0faf17899c48cca2e21e6929a26ebb57a731d9cd51ae6a6af742f0abe591d
MD5 11dd28e58424c1cc26ccb3991cc70a2f
BLAKE2b-256 ed54fa8586faa51cd5c338fb3daaedaea98ad3207b3ca451cad42b2e97143df1

See more details on using hashes here.

File details

Details for the file django_react_jollof-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_react_jollof-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77b39947cd597b4f98f46d195901e5caaf11ce2afacdb872a4513e31b1e7510b
MD5 51c9802be4dc17508801025e1d2cf31a
BLAKE2b-256 7d3e1bd8677102b6979f0a5622164f7e625f92c7fd20e813584c60302ab3fb1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page