Skip to content

This is an e-commerce backend built using Django Rest Framework (DRF) with JWT authentication os used in development is fedora.

Notifications You must be signed in to change notification settings

mwicwiri-bonface/e-commerce-assessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Backend

This is an e-commerce backend built using Django Rest Framework (DRF) with JWT authentication os used in development is fedora.

Technologies Used

  • Django
  • Django Rest Framework (DRF)
  • JWT Authentication
  • Other dependencies (specified in requirements.txt)

Project Structure

The project is structured as follows:

  • e-commerce-assessment/: Django project root directory.
    • accounts/: Auth model and logic.
    • core/: Django project settings directory.
      • settings/: Contains settings files.
        • base.py: Base settings.
        • development.py: Development settings.
        • production.py: Production settings.
    • static-files/: Static files directory.
    • templates/: HTML templates directory.
    • media/: Media files directory (e.g., user-uploaded images).
    • manage.py: Django project management script.

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/mwicwiri-bonface/e-commerce-assessment.git
  2. Navigate to the project directory:

    cd e-commerce-assessment
  3. Install dependencies:

    pip install -r requirements.txt
  4. Update the .env file:

    • Create a new .env file in the project root directory.

    • Add the following environment variables:

      DEBUG=True
      SECRET_KEY=your-secret-key

      Replace your-secret-key with your actual secret key.

  5. Apply migrations:

    python manage.py migrate
  6. Create a superuser (admin) account:

    python manage.py createsuperuser
  7. Start the development server:

    python manage.py runserver
  8. Access the website at http://127.0.0.1:8000/.

Deployment

For deployment to production:

  1. Update the .env file:

    • Modify the .env file to include PostgreSQL database configuration for production:

      DEBUG=False
      SECRET_KEY=your-secret-key
      POSTGRES_DB_NAME=db_name
      POSTGRES_DB_USER=postgres
      POSTGRES_DB_PASSWORD=password
      POSTGRES_DB_HOST=127.0.0.1
      POSTGRES_DB_PORT=5432

      Replace db_name, postgres, password, 127.0.0.1, and 5432 with the appropriate values for your PostgreSQL database.

  2. Collect static files:

    python manage.py collectstatic
  3. Configure your production server (e.g., Gunicorn, Nginx).

  4. Set up environment variables (e.g., SECRET_KEY, POSTGRES_DB_NAME, POSTGRES_DB_USER, POSTGRES_DB_PASSWORD, POSTGRES_DB_HOST, POSTGRES_DB_PORT).

  5. Deploy your application to your chosen hosting provider (e.g., Heroku, AWS, DigitalOcean).

  6. To use the end points you'll need to get an api key from admin dashboard

  7. To get API key for Hosted endpoints [https://ecomapis.pythonanywhere.com/admin/rest_framework_api_key/apikey/], Username: admin, Password: Leo@2024$

Contributors

License

This project is licensed under the MIT License.

About

This is an e-commerce backend built using Django Rest Framework (DRF) with JWT authentication os used in development is fedora.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages