Skip to content

pen1064/misty_dc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

misty_dc

Deploy ML with Django and Docker, I think it's kinda overkill, but a good learning project This is a more fancy setup, if you just deploy one model (not gonna do anything about, refer to misty_dc_light

  1. Create venv and install Django
virtualenv env
env\Scripts\activate.bat
pip3 install django
  1. Start project
cd backend
django-admin startproject mysite
cd mysite folder
pip3 install djangrestframework
pip3 install markdown
pip3 install django-filter
  1. Start endpoints in the project
python3 manage.py startapp endpoints
  1. Create apps, put appname in it
  2. Change apps.py such that it knows we have moved the endpoints directory into apps
class EndpointsConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'apps.endpoints'
  1. Edit apps/endpoints/models.py
  2. Good time to migrate the fields into the db.
python3 manage.py makemigrations
python3 manage.py migrate
  1. Add apps/endpoints/serializers.py
  2. Edit apps/endpoints/views.py
  3. Add the links to urls
  4. Edit settings
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'rest_framework',
      'apps.endpoints',
      'apps.ml'] 
  ROOT_URLCONF = 'misty_dc.urls'
  SECRET_KEY = 'django-insecure-' # delete just for security reason
  1. Edit asgi.py
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'misty_dc.settings')
  1. Edit urls.py
  from apps.endpoints.urls import urlpatterns as endpoints_urlpatterns
  urlpatterns += endpoints_urlpatterns
  1. Make registry to add connect the ML to server side (the worst nightmare)
  2. use wsgi.py to add MLAlgorithm

About

Deploy ML with Django and Docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published