Django Project Setup (Portfolio App) - Sloathking/Foolish-Wizardz GitHub Wiki

Portfolio App Initialization

Note: If you cannot get django-admin to run, you can either use docker, conda, or just run “python -m django startapp portfolioSite” to bypass the need for the django cli.

URI paths and routing

HTML Template

In your portfolio_app folder, create a folder called templates, with a folder called portfolio_app inside of that. Create the file base_template.html in the new portfolio_app folder, and paste the given code into it. Also create an index.html file in this directory, and paste the code given for this page in as well. image The file in \templates\portfolio_app\base_template.html contains links for pages called Logout and Login. It is advisable to add the above lines to make the page work. Without them, the page will produce errors and not load properly.

Version on the sprint01 branch Assuming you’ve created a sprint01 branch already, you can do the following from a command line to commit and push your changes to this branch. First, navigate to the root directory of the local repository. Run the following:

git checkout 'sprint01'
git add .
git commit -m 'commit message'
git push -set-upstream origin sprint01

Adding Static Files

Adding static files

  1. Create the directory where the static files will be stored, make sure it is in the base directory of “portfolio”. The directory should look like this after you complete this section, except you’ll have a single image, either .gif or .png work.

  1. Update settings.py so Django can find the static files

    1. settings.py location: \portfolio\django_project\settings.py

  1. Add line 12 to settings.py

  1. Ensure settings.py has lines 122-128 as such.

  1. Update base_template.html

    1. base_template.html location: \portfolio\portfolio_app\templates\portfolio_app\base_template.html

  1. Add line 1 to the HTML file.

  1. Update line 16 to what is shown.

  1. Open up http://127.0.0.1:8000 and check that the Navbar displays the image.


Version Tagging

For the purpose of this activity, you can tag the current branch with:

git tag GE02 --
Adding static files Create the directory where the static files will be stored, make sure it is in the base directory of “portfolio”. The directory should look like this after you complete this section, except you’ll have a single image, either .gif or .png work.

Update settings.py so Django can find the static files settings.py location: \portfolio\django_project\settings.py

Add line 12 to settings.py

Ensure settings.py has lines 122-128 as such.

Update base_template.html base_template.html location: \portfolio\portfolio_app\templates\portfolio_app\base_template.html

Add line 1 to the HTML file.

Update line 16 to what is shown.

Open up http://127.0.0.1:8000/ and check that the Navbar displays the image.

Version Tagging For the purpose of this activity, you can tag the current branch with: git tag GE02

However, to get the tag to show up in the remote repository, it is crucial that you use: git push origin --tag

⚠️ **GitHub.com Fallback** ⚠️