saumyasarkar11 / mysite

Finish Week 1 from the readme and move on to my video tutorial for week 2 and 4

Home Page:https://vimeo.com/770188927

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django Coursera Week 1

This is the code for the auto-grader assignment for week 1 of Building Web Applications in Django. This code is to be uploaded to your personal accounts on PythonAnywhere. Please follow the instructions below to do the same and get the site live.

Part 1 - Getting our project live on PythonAnywhere

Step 1: Clone the repository by running the command below in the bash console of your pythonanywhere beginner account.
git clone https://github.com/saumyasarkar11/mysite.git
Step 2: Create virtual environment and make sure you put proper python version(We will be using 3.10 here).
mkvirtualenv --python=/usr/bin/python3.10 mysite-env
Step 3: Install all the requirements for our application.
cd mysite
pip install -r requirements.txt
Step 4: Migrate database for our application followed by generation of a single static file for CSS, JS, images, etc.
python manage.py migrate
python manage.py collectstatic
Step 5: Go to Web tab on the top right and click on it. You will see Create a Web Application button, click on it. Select python version 3.10, click Next click on Manual Configuration(make sure you do not click on the “Django” option).
Step 6: Change source code and virtualenv location to that of your respective project by changing the username only. Refer to the image below.

Screenshot 2022-11-04 195107

Step 7a: Change the WSGI configuration file by clicking on the link. Clicking the link will lead you to an editor. Refer to the image to locate the required file.

Screenshot 2022-11-04 200245

Step 7b: Just remove everything from the file and paste the below given code. Make sure you change <your_username> to your respective username and save the file by clicking Save at the top right.
import os
import sys

path = '/home/<your_username>/mysite'
if path not in sys.path:
     sys.path.insert(0, path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Step 8: Add path for static files. Please change your account username. Refer to the image below.

Screenshot 2022-11-05 003606

Step 9: Refresh the site by clicking on the green button at the top of the page. Refer to the image below.

Screenshot 2022-11-04 201043

Part 2 - Configuring our application for the Auto-Grader

Step 1: Visit the url of your deployment with the extension /admin/ (<your_username>.pythonanywhere.com/admin/) to view the application. Login with the credentials "admin" and "password" as username and password respectively.

Step 2: Click on users and after logging in and delete the existing user with username "dj4e".

Screenshot 2022-11-04 203424 (1)

Step 3: Create a new user with the username and password provided by the auto-grader. Refer to the image below.(Note: The password provided for every coursera student is different)

Screenshot 2022-11-04 203759

Screenshot 2022-11-04 204000

Screenshot 2022-11-04 204335

Step 4: Add priviledges to the newly created user by clicking "Choose All" and add "Staff Status" to the user. Refer to the image below.

Screenshot 2022-11-04 204605

Screenshot 2022-11-04 204752

Step 5: Paste your url in the auto-grader and evaluate.

Screenshot 2022-11-04 205339

meme

About

Finish Week 1 from the readme and move on to my video tutorial for week 2 and 4

https://vimeo.com/770188927


Languages

Language:Python 89.9%Language:HTML 9.1%Language:CSS 0.9%