python -m venv venv
venv\Scripts\activate.bat
pip install django
django-admin startproject django_starter
py manage.py runserver
OR
python manage.py runserver ip-addr:8000
py manage.py startapp polls
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
# path("polls/", include('polls.urls'))
path("", include('home.urls')),
path("polls/", include('polls.urls')),
# path("about/", include('about.urls')) #about page is inside home
]
admin.site.site_header = "Demo Admin"
admin.site.site_title = "Demo Admin Portal"
admin.site.index_title = "Welcome to Demo Researcher Portal"
py manage.py makemigrations
py manage.py migrate
py manage.py createsuperuser
python manage.py shell
from django.contrib.auth.models import User
User.objects.get(username="joebloggs", is_superuser=True).delete()
class contact(models.Model):
email = models.CharField(max_length=454)
message = models.CharField(max_length=454)
import contact in home/admin.py
from home.models import contact
admin.site.register(contact)
then add home.apps.HomeConfig
under INSTALLED_APPS in setting.py
Gunicorn: gunicorn is an HTTP server. We’ll use it to serve the application inside the Docker container. Martor: Martor is Markdown plugin for Django
echo martor >> requirements.txt
echo gunicorn >> requirements.txt
Install all the modules using:
pip install -r requirements.txt
python -m pip install djangorestframework
pip install djangorestframework-simplejwt
pip freeze
pip install django-environ
for postgres
pip install psycopg2