sarahsaturday / server-whereandwhen

0 stars 0 forks source link

Set up Django Project #3

Closed sarahsaturday closed 1 year ago

sarahsaturday commented 1 year ago

Task: Set Up Django Project -- see comments for example from course work

[MESSAGES CONTROL] disable=broad-except,imported-auth-user,missing-class-docstring,no-self-use,abstract-method

[MASTER] disable=C0114 ' > .pylintrc**

projectname-

"python.linting.pylintArgs": [ "--load-plugins=pylint_django", "--django-settings-module=honeyrae.settings", ],

*curl -L -s 'https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore' > .gitignore echo '.sqlite3' >> .gitignore**

mkdir projectnameapi/models projectnameapi/views touch projectnameapi/models/init.py projectnameapi/views/init.py

launch.json

{ "version": "0.2.0", "configurations": [ { "name": "Python: Django", "type": "python", "request": "launch", "program": "${workspaceFolder}/manage.py", "args": ["runserver"], "django": true, "autoReload":{ "enable": true } } ] }

sarahsaturday commented 1 year ago

From: https://github.com/nashville-software-school/bangazon-llc/blob/cohort-64/book-3-levelup/chapters/HR_INSTALLS.md

settings.py

INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'rest_framework.authtoken', 'corsheaders', 'repairsapi', ]

REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticated', ], }

CORS_ORIGIN_WHITELIST = ( 'http://localhost:3000', 'http://127.0.0.1:3000' )

MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ]