Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reljicd/django-tutorial
Django tutorial
https://github.com/reljicd/django-tutorial
django django-templates python sqlite3
Last synced: 21 days ago
JSON representation
Django tutorial
- Host: GitHub
- URL: https://github.com/reljicd/django-tutorial
- Owner: reljicd
- Created: 2017-06-04T08:45:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-05T09:00:09.000Z (over 7 years ago)
- Last Synced: 2024-11-07T14:11:55.541Z (2 months ago)
- Topics: django, django-templates, python, sqlite3
- Language: Python
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Django Tutorial
Following Django tutorial from [Django website](https://docs.djangoproject.com/en/1.11/intro/tutorial01/)
## Virtual Environment
Make virtual environment in root of the project with:
```
python3 -m venv virtual-env
```
Activate it with:
```
source virtual-env/bin/activate
```
Install Requirements with:
```
(virtual-env) ~/mysite$ python -m pip install -r requirements.txt
```## Database setup
You need to be in **mysite** folder for this command:
```
(virtual-env) ~/mysite$ python manage.py migrate
```
To load initial data:
```
(virtual-env) ~/mysite$ python manage.py loaddata polls/fixtures/initial_data.json
```
To dump your data to initial_data.json:
```
(virtual-env) ~/mysite$ python manage.py dumpdata polls > polls/fixtures/initial_data.json
```
## The development web serverYou need to be in **mysite** folder for this command:
```
(virtual-env) ~/mysite$ python manage.py runserver
```### Changing the port
By default, the runserver command starts the development server on the internal IP at port 8000.
If you want to change the server’s port, pass it as a command-line argument. For instance, this command starts the server on port 8080:
```
(virtual-env) ~/mysite$ python manage.py runserver 8080
```
If you want to change the server’s IP, pass it along with the port. For example, to listen on all available public IPs (which is useful if you are running Vagrant or want to show off your work on other computers on the network), use:
```
(virtual-env) ~/mysite$ python manage.py runserver 0:8000
```
**0** is a shortcut for **0.0.0.0**. Full docs for the development server can be found in the runserver reference.## Django admin
Create superuser like this:
```
(virtual-env) ~/mysite$ python manage.py createsuperuser
Username: admin
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
```After this you can use Django admin. Just go to the page **http://127.0.0.1:8000/admin/** and use credential you just entered.