GithubHelp home page GithubHelp logo

mimi-netizen / hive Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 17.87 MB

A website that let's you sell your services to potential customers.

Python 67.23% CSS 4.69% HTML 28.08%
django django-admin django-application django-framework django-project django-rest-framework python python-3 python-django-bootstrap python-django-web-application python3

hive's Introduction

Hive

image

Hive is a website where people can buy and sell services like housekeeping, tutoring, errand running, massage & accupuncture services and more! image image image image

Virtual Environment

How to activate virtual environemtn

source venv/bin/activate

How to deactivate

deactivate

Basic Django Commands used

django-admin help
django-admin startproject <<name-of-project>> .

python manage.py startapp <<name-of-app>>

python manage.py runserver
python manage.py makemigrations
python manage.py migrate

python manage.py createsuperuser
python manage.py collectstatic

Environment Variables to be set

SECRET_KEY
DJANGOAPPMODE (Debug for local dev and Prod for deployment)
USEDEBUGDB (True in local False in prod)

Email

EMAIL_HOST_USER
EMAIL_HOST_PASSWORD

Postgres

DBNAME
DBUSER
DBPASSWORD
DBHOST
DBPORT

Bucketeer (in heroku)

BUCKETEER_AWS_ACCESS_KEY_ID
BUCKETEER_AWS_SECRET_ACCESS_KEY
BUCKETEER_AWS_REGION
BUCKETEER_BUCKET_NAME

Django Messages

Implementing it in base.html

django.contrib.messages (already installed)

Django Environment Variable

  1. Import environ package
    import environ
  2. Initialize environ
    env = environ.Env() and env.read_env()

create .env file to manage environment variable which is left out in git repository.

This .env is used for local development

Send email

Use service called "mailgun"

  1. Go to Heroku to set mailgun as resource
  2. Go to mailgun and get credentials
  3. set settings:
EMAIL_BACKEND=
EMAIL_HOST=
EMAIL_PORT=
EMAIL_USER_TLS=
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')

What should be done

  • when new profile image is selected, the image shown should change as well
  • see how the bio in the profile can have larger text area

How to serve static file in production

We use whitenoise to serve static file.

Once you install it you should add following to Middleware:

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    "whitenoise.middleware.WhiteNoiseMiddleware",
    ...
]

Then in the settings:

STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

Deployment to Heroku (Heroku CLI)

heroku login
heroku git:remote -a <name-of-app-in-heroku>

Files required

Create following files:

  • Procfile
    • web: gunicorn hive.wsgi
  • requirements.txt
  • runtime.txt
    • should indicate python runtime (python-3.9.14 for example or whatever python runtime used for the virtual machine)

Deployment

git add .
git commit -m "..."
git push heroku main

hive's People

Contributors

mimi-netizen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.