Activity 18: Fork testdeploy Github Repository and deploy it to Render.com

STEP 1: Create a folder and name it (whatever you like) “act-18-SA

STEP 2: Launch it on "cmd" or terminal

  • open the link and click fork

after clicking fork, you will create a new repository for the forked repo

  • name the new (forked) repository

  • create fork

to clone, use this command:

git clone “copied repository”

git clone https://github.com/FranciscoJohannes/Basic_crud_python_flask_api.git

STEP 6: Go to render and log-in

go to dashboard section, in service type click new web service

when open: connect it to the git provider and choose the github icon to connect the github account in render

STEP 7: Choose the account in github

click the account to install render

mine is “FranciscoJohannes”

choose whether all repositories or only select repositories

to me is all repositories, then click install

to confirm access, use your github password then confirm

STEP 8: Choose the repository or the forked repository (https://github.com/FranciscoJohannes/Basic_crud_python_flask_api)

after connecting, add a unique name on the created web service

then scroll down, then provide the language (programming language), branch, region, build command, and start command

on language, it will be “python 3”

on branch, it will be “main”

on region, it will be “Singapore (south ease asia)”

on build command, it will be “pip install -r requirements.txt

on start command, it will be “python app.py

STEP 9: On Instance type, choose the free on the hobby projects

STEP 10: Ignore the enviroment variables then click the button “Deploy Web Service

after clicking the button wait for the deployment

when done, it will now be live on the internet

STEP 11: Go back to “cmd“ or terminal and change the directory

to change the directory write cd {name of the api}

cd Basic_crud_python_flask_api

STEP 12: After changing the directory, create a python virtual environment

use this command to create a virtual environment:

python -m venv myvenv

Step 13: Activate virtual environment

to activate the virtual environment, use this command below:

myvenv\Scripts\activate

Once activated, the terminal prompt changes to show the name of the environment (in this case, (myvenv)), indicating that you are now working within the virtual environment.

Step 14: Install the requirements or dependencies

to install dependencies use this command

pip install -r requirements.txt

the command above will install all the listed dependencies inside in given from the forked repository in requirements.txt

Add myvenv on gitignore

so, adding the myvenv directory to .gitignore is essential to prevent the virtual environment files from being tracked by version control tools like Git. Since the myvenv directory contains environment-specific files that are not necessary for the application’s source code, it is a good practice to exclude it from version control to keep the repository clean and reduce clutter.

followed the steps on how to add myvenv to the .gitignore file

Steps to add myvenv to .gitignore, use the command below:

nul > .gitignore

Freeze the requirements for future uses

pip freeze > requirements.txt

Step 15: Go to postman and create a collection/folder

click the + button above to create a collection/folder

i named my folder “Deployment in render

inside the “Deployment in render“ folder, create another folder and named it students

on the students folder add a request, GET request for students

but before that, go back to render and copy the link in the events tab

after copying, paste it on the added request in postman

to get the students data use /students in the copied link then click “send

there you get the students data below

Step 16: Add a student

Step 17: Get all students by id

Step 18: Edit students by id

Step 19: Delete students by id

it now deleted, if we get all the students

list of all the request and folders

to check, on keyboard press ctrl + right click (in mouse) to open the link, or copy and paste the link on another tab

oh, and don’t forget to add “/students” at the end of the link

Render link: https://johabasic-crud-python-flask-api.onrender.com/students

GitHub (forked) Repository link: https://github.com/FranciscoJohannes/Basic_crud_python_flask_api