diff --git a/Django/1_Setup.md b/Django REST Framework Guide/1_Setup.md similarity index 93% rename from Django/1_Setup.md rename to Django REST Framework Guide/1_Setup.md index 463abf9..0ea129f 100644 --- a/Django/1_Setup.md +++ b/Django REST Framework Guide/1_Setup.md @@ -24,7 +24,7 @@ You will need to install the latest version of Python (version 3.11.2 as of 2/19 ![[_resources/1_Setup/373ea207d1abd6f0a734506d8ab4acbc_MD5.jpg]] -To check if you have a working install, open a command line (CMD) and type in **python --version** +To check if you have a working install, open a command line (CMD) and type in `python --version` ![[_resources/1_Setup/5d1081e556bd19260f14a235fef4e383_MD5.jpg]] @@ -54,7 +54,7 @@ gunicorn==21.0.0 Managing dependencies in a single installation is a nightmare you definitely don't want to deal with. Using Pipenv, or other alternatives like Python venv (which is not discussed in this guide) will help you avoid these issues. -Open up a command line (CMD) and type in **pip install --user pipenv** to install pipenv +Open up a command line (CMD) and type in `pip install --user pipenv` to install Pipenv This will use the package manager for Python (akin to npm for Javascript/Typescript projects) to install the Pipenv package @@ -72,6 +72,4 @@ This guide does not cover the proper usage of Git and so you may need to look up ![[_resources/1_Setup/6198958f0bad6ed532a840df3435ad23_MD5.jpg]] You can proceed with the typical installation using defaults (no need to change anything), just click Next/Install. -With that out of the way, you can proceed to setting up your Django REST Framework project. - -
\ No newline at end of file +With that out of the way, you can proceed to setting up your Django REST Framework project. \ No newline at end of file diff --git a/Django REST Framework Guide/2_Initialize_Your_First_Project.md b/Django REST Framework Guide/2_Initialize_Your_First_Project.md new file mode 100644 index 0000000..843c06f --- /dev/null +++ b/Django REST Framework Guide/2_Initialize_Your_First_Project.md @@ -0,0 +1,95 @@ +# Initialize your first Project + +### Start a New Project + +With your tooling properly set up in the previous chapter, you can now start with setting up your Django project. + +Create a new folder for your project. + +![[_resources/2_Initialize_Your_First_Project/4d6ba511be479a6749bc4baeb985aa54_MD5.jpg]] + +And open the folder in your editor of choice, such as VSCode + +![[_resources/2_Initialize_Your_First_Project/da331137b939a5faf4924ee8a21b3fca_MD5.jpg]] + +Create a new Python virtual environment with Pipenv by running `pipenv shell` + +![[_resources/2_Initialize_Your_First_Project/db56664f1d7fb30451131394845729c5_MD5.jpg]] + +This will create a Pipfile in your project folder. This will track what packages you install in your virtual environment + +![[_resources/2_Initialize_Your_First_Project/3567fe21bc31ff29f392e112cd1e9308_MD5.jpg]] +I highly suggest you install the [Python VSCode extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) at this step to help with your developer experience + +![[_resources/2_Initialize_Your_First_Project/4997f4d3a648a6ab9f5ac19c8211374f_MD5.jpg]] +### Initialize Git + +When working on software projects such as Django, you will need to be able to track small changes. We'll be using Git for that + +We previously installed Git, now's the time to use it. In your terminal, run the command `git init` + +![[_resources/2_Initialize_Your_First_Project/765336c9701ec47364bcd428b580e1ce_MD5.jpg]] + +If successful, this will create a hidden .git folder in your project + +![[_resources/2_Initialize_Your_First_Project/f1c979f796fda6b41f83a37744b469e2_MD5.jpg]] + +There are some files in your projects that won't need to be tracked for changes (database files, and passwords!) + +Download the gitignore file [here](https://fileserver.06222001.xyz/files/Bookstack/gitignore) below and drop it into your project's folder + +![[_resources/2_Initialize_Your_First_Project/d5a36b65d64255b05bc81a1709ca1158_MD5.jpg]] + +Make sure to rename this to **.gitignore** (take note of the dot before the filename!) + +You can also choose to search for your own .gitignore template online for Django, whichever suits best for you. + +### Select your Interpreter + +Since you're using a virtual environment such as Pipenv, you will need to specify it to be used rather than the default Python installation + +Press **CTRL + Shift + P** to open the VSCode menu and type in **Select Interpreter**. + +![[_resources/2_Initialize_Your_First_Project/d4da2b316a92c4444c01272187355abd_MD5.jpg]] + +Select the virtual Python environment you created earlier (eg. the one created from **pipenv shell)** + +![[_resources/2_Initialize_Your_First_Project/9d0f73aa1a1929a62a482e23bf2e94b5_MD5.jpg]] + +### Install Dependencies and Packages + +To use Django, you'll need to install Django! + +On your current project's code editor, open a terminal or command line and type in the command + +`pipenv install django djangorestframework` + +![[_resources/2_Initialize_Your_First_Project/0cfa5562ea461edb202130a6f49a7cea_MD5.jpg]] + +This will update your Pipfile and create a Pipfile.lock to reflect the installed packages + +![[_resources/2_Initialize_Your_First_Project/bb5d783ca5d693451fc98425856492b9_MD5.jpg]] +### Initialize the Project + +In your code editor's terminal or command prompt, run the command +`django-admin startproject PROJECT\_NAME` + +![[_resources/2_Initialize_Your_First_Project/9fa2115388cde426285a656a7e9965d5_MD5.jpg]]](https://bookstack.06222001.xyz/uploads/images/gallery/2024-09/i5bimage.png) + +Be sure to replace it with your own project name! I named mine **djangobackend**. + +A new directory will be created, containing your Django project's files + +[![[_resources/2_Initialize_Your_First_Project/a137cf212011825e092997818ff20658_MD5.jpg]] + +Change your directory in the terminal to the folder just created eg. **cd PROJECT\_NAME** + +![[_resources/2_Initialize_Your_First_Project/ab38fdac55d8d6331471d609707dfdb9_MD5.jpg]] + +Once that's done, run the command `python manage.py runserver 0.0.0.0:8000` to start your Django project + +![[_resources/2_Initialize_Your_First_Project/b281e8b8bd83d316d45c1d0e810ce0a1_MD5.jpg]] + +Your Django project will now be visible on the URL **[https://localhost:8000](https://localhost:8000)** + +![[_resources/2_Initialize_Your_First_Project/377f5134b0525b830116a64d7699368f_MD5.jpg]] \ No newline at end of file diff --git a/Django/_resources/1_Setup/353e9c415078b3d4a18d7bd93294df1c_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/353e9c415078b3d4a18d7bd93294df1c_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/353e9c415078b3d4a18d7bd93294df1c_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/353e9c415078b3d4a18d7bd93294df1c_MD5.jpg diff --git a/Django/_resources/1_Setup/373ea207d1abd6f0a734506d8ab4acbc_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/373ea207d1abd6f0a734506d8ab4acbc_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/373ea207d1abd6f0a734506d8ab4acbc_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/373ea207d1abd6f0a734506d8ab4acbc_MD5.jpg diff --git a/Django/_resources/1_Setup/3ed75d2e3ff3aad581b4cd7c2af748a3_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/3ed75d2e3ff3aad581b4cd7c2af748a3_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/3ed75d2e3ff3aad581b4cd7c2af748a3_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/3ed75d2e3ff3aad581b4cd7c2af748a3_MD5.jpg diff --git a/Django/_resources/1_Setup/5d1081e556bd19260f14a235fef4e383_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/5d1081e556bd19260f14a235fef4e383_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/5d1081e556bd19260f14a235fef4e383_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/5d1081e556bd19260f14a235fef4e383_MD5.jpg diff --git a/Django/_resources/1_Setup/6198958f0bad6ed532a840df3435ad23_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/6198958f0bad6ed532a840df3435ad23_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/6198958f0bad6ed532a840df3435ad23_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/6198958f0bad6ed532a840df3435ad23_MD5.jpg diff --git a/Django/_resources/1_Setup/8d193fcb83f676cd16e263f78f965bc5_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/8d193fcb83f676cd16e263f78f965bc5_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/8d193fcb83f676cd16e263f78f965bc5_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/8d193fcb83f676cd16e263f78f965bc5_MD5.jpg diff --git a/Django/_resources/1_Setup/8e0864b9971e3e0ec0843db1494a9164_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/8e0864b9971e3e0ec0843db1494a9164_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/8e0864b9971e3e0ec0843db1494a9164_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/8e0864b9971e3e0ec0843db1494a9164_MD5.jpg diff --git a/Django/_resources/1_Setup/aef7461456894804006fa820f6a2061e_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/aef7461456894804006fa820f6a2061e_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/aef7461456894804006fa820f6a2061e_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/aef7461456894804006fa820f6a2061e_MD5.jpg diff --git a/Django/_resources/1_Setup/c2f115b66c9b0f4e93ea54d1091f9696_MD5.jpg b/Django REST Framework Guide/_resources/1_Setup/c2f115b66c9b0f4e93ea54d1091f9696_MD5.jpg similarity index 100% rename from Django/_resources/1_Setup/c2f115b66c9b0f4e93ea54d1091f9696_MD5.jpg rename to Django REST Framework Guide/_resources/1_Setup/c2f115b66c9b0f4e93ea54d1091f9696_MD5.jpg diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/0cfa5562ea461edb202130a6f49a7cea_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/0cfa5562ea461edb202130a6f49a7cea_MD5.jpg new file mode 100644 index 0000000..5938e1d Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/0cfa5562ea461edb202130a6f49a7cea_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/3567fe21bc31ff29f392e112cd1e9308_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/3567fe21bc31ff29f392e112cd1e9308_MD5.jpg new file mode 100644 index 0000000..691f1ac Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/3567fe21bc31ff29f392e112cd1e9308_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/377f5134b0525b830116a64d7699368f_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/377f5134b0525b830116a64d7699368f_MD5.jpg new file mode 100644 index 0000000..5c56032 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/377f5134b0525b830116a64d7699368f_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/4997f4d3a648a6ab9f5ac19c8211374f_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/4997f4d3a648a6ab9f5ac19c8211374f_MD5.jpg new file mode 100644 index 0000000..9077970 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/4997f4d3a648a6ab9f5ac19c8211374f_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/4d6ba511be479a6749bc4baeb985aa54_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/4d6ba511be479a6749bc4baeb985aa54_MD5.jpg new file mode 100644 index 0000000..7afa5d6 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/4d6ba511be479a6749bc4baeb985aa54_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/765336c9701ec47364bcd428b580e1ce_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/765336c9701ec47364bcd428b580e1ce_MD5.jpg new file mode 100644 index 0000000..668f280 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/765336c9701ec47364bcd428b580e1ce_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/9d0f73aa1a1929a62a482e23bf2e94b5_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/9d0f73aa1a1929a62a482e23bf2e94b5_MD5.jpg new file mode 100644 index 0000000..262cb0c Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/9d0f73aa1a1929a62a482e23bf2e94b5_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/9fa2115388cde426285a656a7e9965d5_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/9fa2115388cde426285a656a7e9965d5_MD5.jpg new file mode 100644 index 0000000..7e24c2e Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/9fa2115388cde426285a656a7e9965d5_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/a137cf212011825e092997818ff20658_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/a137cf212011825e092997818ff20658_MD5.jpg new file mode 100644 index 0000000..f9a46bc Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/a137cf212011825e092997818ff20658_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/ab38fdac55d8d6331471d609707dfdb9_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/ab38fdac55d8d6331471d609707dfdb9_MD5.jpg new file mode 100644 index 0000000..3de7ed0 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/ab38fdac55d8d6331471d609707dfdb9_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/b281e8b8bd83d316d45c1d0e810ce0a1_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/b281e8b8bd83d316d45c1d0e810ce0a1_MD5.jpg new file mode 100644 index 0000000..63298e9 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/b281e8b8bd83d316d45c1d0e810ce0a1_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/bb5d783ca5d693451fc98425856492b9_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/bb5d783ca5d693451fc98425856492b9_MD5.jpg new file mode 100644 index 0000000..6054b43 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/bb5d783ca5d693451fc98425856492b9_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/d4da2b316a92c4444c01272187355abd_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/d4da2b316a92c4444c01272187355abd_MD5.jpg new file mode 100644 index 0000000..a16cb7b Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/d4da2b316a92c4444c01272187355abd_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/d5a36b65d64255b05bc81a1709ca1158_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/d5a36b65d64255b05bc81a1709ca1158_MD5.jpg new file mode 100644 index 0000000..9b4bf55 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/d5a36b65d64255b05bc81a1709ca1158_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/da331137b939a5faf4924ee8a21b3fca_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/da331137b939a5faf4924ee8a21b3fca_MD5.jpg new file mode 100644 index 0000000..dd71525 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/da331137b939a5faf4924ee8a21b3fca_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/db56664f1d7fb30451131394845729c5_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/db56664f1d7fb30451131394845729c5_MD5.jpg new file mode 100644 index 0000000..13d4b1a Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/db56664f1d7fb30451131394845729c5_MD5.jpg differ diff --git a/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/f1c979f796fda6b41f83a37744b469e2_MD5.jpg b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/f1c979f796fda6b41f83a37744b469e2_MD5.jpg new file mode 100644 index 0000000..0b25556 Binary files /dev/null and b/Django REST Framework Guide/_resources/2_Initialize_Your_First_Project/f1c979f796fda6b41f83a37744b469e2_MD5.jpg differ