django-admin startproject mysite .
Don't forget to add the period (or dot) . at the end!
-
change your timezone and languages in settings.py
time zones languages -
We'll also need to add a path for static files.
add this line STATIC_ROOT = os.path.join(BASE_DIR, 'static')
below STATIC_URL = '/static/'
-
ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
changeALLOWED_HOSTS = []
NB:we are goig to deploy it at pythonanywhere -
Data base setup using default sqlite3 which is already deifined
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } }
To create a database for our blog, let's run the following in the console: python manage.py migrate
python manage.py runserver
python manage.py startapp blog
After creating an application, we also need to tell Django that it should use it. We do that in the file mysite/settings.py
open it in your code editor. We need to find INSTALLED_APPS
and add a line containing 'blog',
just above ]. So the final product should look like this:
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog', ]