...
Go into the project folder that was created when the repo was cloned.
Start the project. Be sure to enter the
.
at the end of the command line in order to create the project in the current folder. Otherwise, django will create a subfolder with the project name and place it one level down.Code Block django-admin startproject <project name> .
Set the ALLOWED_HOSTS setting in the
settings.py
file. For example:Code Block ALLOWED_HOSTS = ["ece-li-scheduling-2.eng.uwaterloo.ca", "localhost", "127.0.0.1"]
Push first commit
Create new branch
initialize
. The project access token is not permitted to push tomain
branch.Code Block git branch initialize git checkout initialize git push --set-upstream origin initialize
Commit the initial files created by django for the project.
Code Block git add . git commit -m "Initialize django project." git push
Merge the
initialize
branch intomain
branch.
...
The main steps for the Dockerfile are:
Create a
.ssh
folder.Copy the deploy key into the
.ssh
folder.Add gitlab server to
known_hosts
file.Setup
.ssh/config
file to explicitly specify the deploy key and username to be used.Clone the repo.
Here is some example Dockerfile code.
Code Block RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh ADD id_rsa_ece_li_scheduling_deploy /root/.ssh/id_rsa_ece_li_scheduling_deploy RUN chmod 600 /root/.ssh/id_rsa_ece_li_scheduling_deploy RUN ssh-keyscan -H git.uwaterloo.ca >> /root/.ssh/known_hosts RUN echo "Host git.uwaterloo.ca\n\ HostName git.uwaterloo.ca\n\ IdentityFile /root/.ssh/id_rsa_ece_li_scheduling_deploy\n\ StrictHostKeyChecking no\n\ User ist-git" >> /root/.ssh/config RUN chmod 600 /root/.ssh/config RUN git clone ist-git@git.uwaterloo.ca:d24lau/ece_li_scheduling.git
...
ALLOWED_HOSTS
Modify ALLOWED_HOSTS.