On this post I will work you through the process of deploying you app! to the external service we'll be using GitHub which is a code hosting service. Deploying is the process of publishing your application on the Internet so people can finally go and see your app. :)
Git is a very popular "version control system" used by a lot of programmers. This software can track changes to files over time so that you can recall specific versions later. A bit like the "track changes" feature in word processor programs (e.g., Microsoft Word or LibreOffice Writer), but much more powerful.
Installing Git: Debian
apt install git
Git tracks changes to a particular set of files in what's called a code repository (or "repo" for short). Let's start one for our project. Open up your console and run these commands, to make sure your on the project-level directory. find out your current working directory
pwd
#find out your current working directory
/root/django/finalpro2 -----------
Git will track changes to all the files and folders in this directory.
ls -ali # make sure your project directory looks somehow like this
1209548 drwxr-xr-x 6 root root 4096 May 29 21:42 .
671852 drwxr-xr-x 15 root root 4096 May 28 08:29 ..
1209729 drwxr-xr-x 4 root root 4096 May 29 21:09 accounts
1209727 -rw-r--r-- 1 root root 131072 May 29 21:42 db.sqlite3
1209713 -rwxr-xr-x 1 root root 628 May 28 08:46 manage.py
1209712 drwxr-xr-x 3 root root 4096 May 29 21:33 news_art
1209714 drwxr-xr-x 4 root root 4096 May 29 21:33 templates
1209549 drwxr-xr-x 6 root root 4096 May 28 08:44 venv
git init #
initializing the repository
Initialized empty Git repository in /root/django/finalpro2/.git/
git config --global user.name "Your Name"
git config --global user.email you@example.com
There are some files we want git to ignore. We do this by creating a file called
.gitignore
nano .gitignore
*.pyc
*~
__pycache__
venv
db.sqlite3
.DS_Store
pip3 freeze > requirements.txt # write requirements of your project
git status # enumerate the files and directory that will be commited
On branch master
Initial commit
Untracked files:
(use "git add ..." to include in what will be committed)
.gitignore
accounts/
manage.py
news_art/
requirements.txt
templates/
nothing added to commit but untracked files present (use "git add" to track)
git add --all
git commit -m "Authentication, first commit"
[master (root-commit) ee683bb] Authentication, first commit
19 files changed, 384 insertions(+)
create mode 100644 .gitignore
create mode 100644 accounts/__init__.py
create mode 100644 accounts/admin.py
create mode 100644 accounts/apps.py
create mode 100644 accounts/migrations/__init__.py
create mode 100644 accounts/models.py
create mode 100644 accounts/tests.py
create mode 100644 accounts/urls.py
create mode 100644 accounts/views.py
create mode 100755 manage.py
create mode 100644 news_art/__init__.py
create mode 100644 news_art/settings.py
create mode 100644 news_art/urls.py
create mode 100644 news_art/wsgi.py
create mode 100644 requirements.txt
create mode 100644 templates/accounts/register.html
create mode 100644 templates/base.html
create mode 100644 templates/home.html
create mode 100644 templates/registration/login.html
Go to GitHub.com and sign up for a new, free user account, or login if you already have an account.
Then, create a new repository, giving it the name "django-authentication". Leave
the "initialize with a README" checkbox unchecked, leave the .gitignore
option blank (we've done that manually) and leave the License as None.
hook up the Git repository on your computer to the one up on GitHub.
git clone --mirror https://github.com/kazz54/django-authentication.git
Cloning into bare repository 'django-authentication.git'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
git push origin master --force
Username for 'https://github.com': username you entered when you created your account Password for 'https://you@example.com@github.com':
Counting objects: 25, done.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (25/25), 5.72 KiB | 0 bytes/s, done.
Total 25 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/kazz54/django-authentication.git
+ bf370dc...ee683bb master -> master (forced update)
Your code is now on GitHub. Go and check it out!