Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beebus/hello-world-django
"Hello World" Django application using Windows 10 command line and the GitHub.com website interface.
https://github.com/beebus/hello-world-django
django hello-world helloworld python python-3 windows windows-10 windows10
Last synced: 27 days ago
JSON representation
"Hello World" Django application using Windows 10 command line and the GitHub.com website interface.
- Host: GitHub
- URL: https://github.com/beebus/hello-world-django
- Owner: beebus
- License: gpl-3.0
- Created: 2021-02-02T19:20:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-11T15:17:20.000Z (about 3 years ago)
- Last Synced: 2024-10-26T12:36:10.546Z (2 months ago)
- Topics: django, hello-world, helloworld, python, python-3, windows, windows-10, windows10
- Language: Python
- Homepage:
- Size: 303 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hello-world-django
I used a Windows 10 environment command line and GitHub.com to create a "Hello World" Django application using the website URLs listed below.https://djangoforbeginners.com/hello-world/
https://docs.python.org/3/library/venv.html
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/In the Cortana search box, type in “cmd” then click “Run as administrator”.
Navigate to your project folder by using:
C:\> cd (folder name)
C:\> dir/w (to list the directory contents… similar to ls in Mac/Linux terminal.
The /w switch causes the contents to be listed in several columns, wider, rather than in one long list.)Windows:
1. Navigate to project folder.
2. C:\> virtualenv venv (it seems like this command only needs to be done once per command prompt session)
If this command doesn’t work, you probably need to install virtualenv by running the following command:
C:\> py -m pip install –user virtualenvIf “virtualenv venv” continues to not work, try this one:
C:\> py -m venv env
3. C:\> venv\scripts\activate (same for this)
If you used “py -m venv env” in the previous step, use this command instead:
C:\> .\env\Scripts\activate
You should see something like this:
I went ahead and added a .gitignore file to my project directory that contained the following:
.DS_Store
node_modules
.tmp
npm-debug.log
wisdompets/db.sqlite3
__pycache__/
*.py[cod]Here is what I have so far in my project folder:
The env folder that you see what automatically created by the command “py -m venv env”.
Then the command “.\env\Scripts\activate” told it to use that folder.Now, keep in mind that we will not be committing this folder to GitHub because of:
which it says on the website, https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/so we will add this folder to the .gitignore file:
I think we just add a new line “env” or “env/”
.DS_Store
node_modules
.tmp
npm-debug.log
wisdompets/db.sqlite3
__pycache__/
*.py[cod]
envBack in the cmd window, in the virtual environment, install Django using pip:
C:\> pip install django~=3.1.0
C:\> cd env\scripts
C:\> python.exe -m pip install –upgrade pip
C:\> python.exe django-admin.py startproject config D:\LinkedIn_Learning\Python\hello_world_django
C:\> cd ..
C:\> cd ..
C:\> dir/w
So it looks like when I initially tried to run “django-admin startproject config .” it was trying to use a different python.exe instead of the virtual environment’s python.exe.
I’ll have to look into how this is corrected later.
I bet this is easier on a Mac or Linux in terminal.C:\> python manage.py runserver
Then go to http://127.0.0.1:8000/ in the browser.
CTRL-Pause/Break causes the server to stop, and returns you to a prompt in the cmd window.
(env) C:\> git –version
If this is not recognized, then you’ll probably need to go to https://git-scm.com/download/win to download Git for Windows.After installing, you’ll need to close the cmd window and reopen it (in admin mode).
Navigate again to your project folder.
Activate the virtual environment:
C:\> .\env\Scripts\activate
C:\> git –version
C:\> git config –global user.name “name”
C:\> git config –global user.email “email address”
C:\> git initGo to GitHub.com and create an empty repo. I’m calling mine “hello-world-django”.
C:\> git add .
C:\> git commit -m “first commit”
C:\> git branch -M master
C:\> git remote add origin https://github.com/beebus/hello-world-django.git
C:\> git push -u origin master