mirror of
https://github.com/Sosokker/ku-polls.git
synced 2025-12-19 05:24:05 +01:00
Merge pull request #12 from Sosokker/iteration1
Merge new README.md and Delete sqlite.db from remote/ Add .json data
This commit is contained in:
commit
4409afaef9
2
.gitignore
vendored
2
.gitignore
vendored
@ -58,7 +58,7 @@ cover/
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
# db.sqlite3
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
|
||||
47
README.md
47
README.md
@ -5,32 +5,61 @@ on the [Django Tutorial project](https://docs.djangoproject.com/en/4.2/intro/tut
|
||||
|
||||
## Install and Run
|
||||
|
||||
Window
|
||||
|
||||
1. Install [Python 3.11.4 or later](https://www.python.org/downloads/)
|
||||
2. Run these commands to clone and install requirements.txt
|
||||
```bash
|
||||
git clone https://github.com/Sosokker/ku-polls
|
||||
cd ku-polls
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
3. Create file call `.env` in `ku-polls` directory and add this line
|
||||
```bash
|
||||
SECRET_KEY=your_secret_key
|
||||
```
|
||||
|
||||
You can generate your own `your_secret_key` by this command
|
||||
```bash
|
||||
python manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
|
||||
```
|
||||
or
|
||||
- [Django Secret Key Generator #1](https://djecrety.ir/)
|
||||
- [Django Secret Key Generator #2](https://miniwebtool.com/django-secret-key-generator/)
|
||||
|
||||
**Don't forget to change `your_secret_key` to your secret key (without quote)**
|
||||
|
||||
4. Run these commands
|
||||
```bash
|
||||
python manage.py migrate
|
||||
python manage.py loaddata data/polls-v1.json
|
||||
python manage.py loaddata data/user.json
|
||||
python manage.py runserver
|
||||
```
|
||||
Then connect to `127.0.0.1:8000/`
|
||||
Then connect to `http://127.0.0.1:8000/` or `localhost:8000/`
|
||||
|
||||
**Optional**
|
||||
**Recommend**
|
||||
|
||||
You can create virtual environment by using this command before install requirements.txt
|
||||
|
||||
1. Install virtualenv via pip
|
||||
|
||||
```bash
|
||||
python -m pip install --user virtualenv
|
||||
```
|
||||
2. Run these commands
|
||||
```bash
|
||||
python -m virtualenv .venv
|
||||
```
|
||||
or
|
||||
```bash
|
||||
python -m venv .venv
|
||||
```
|
||||
then
|
||||
3. Use `virtual environment`
|
||||
```bash
|
||||
.venv\Scripts\activate
|
||||
```
|
||||
|
||||
## Demo Superuser
|
||||
|
||||
|Username|Password|
|
||||
|:--:|:--:|
|
||||
|admin|ineedmorebullets|
|
||||
|
||||
## Project Documents
|
||||
|
||||
All project documents are in the [Project Wiki](https://github.com/Sosokker/ku-polls/wiki).
|
||||
|
||||
54
data/polls-v1.json
Normal file
54
data/polls-v1.json
Normal file
@ -0,0 +1,54 @@
|
||||
[
|
||||
{
|
||||
"model": "polls.question",
|
||||
"pk": 1,
|
||||
"fields": {
|
||||
"question_text": "Python vs C++, which one is better in your opinion?",
|
||||
"pub_date": "2023-08-28T13:38:42Z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "polls.question",
|
||||
"pk": 2,
|
||||
"fields": {
|
||||
"question_text": "The chicken and the egg, which came first?",
|
||||
"pub_date": "2023-08-28T13:39:16Z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "polls.choice",
|
||||
"pk": 4,
|
||||
"fields": {
|
||||
"question": 2,
|
||||
"choice_text": "Chicken",
|
||||
"votes": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "polls.choice",
|
||||
"pk": 5,
|
||||
"fields": {
|
||||
"question": 2,
|
||||
"choice_text": "Egg",
|
||||
"votes": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "polls.choice",
|
||||
"pk": 6,
|
||||
"fields": {
|
||||
"question": 1,
|
||||
"choice_text": "Python!",
|
||||
"votes": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "polls.choice",
|
||||
"pk": 7,
|
||||
"fields": {
|
||||
"question": 1,
|
||||
"choice_text": "C++",
|
||||
"votes": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
20
data/user.json
Normal file
20
data/user.json
Normal file
@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"model": "auth.user",
|
||||
"pk": 1,
|
||||
"fields": {
|
||||
"password": "pbkdf2_sha256$600000$iGfCFe97r89Z86pdlQGUnB$WWlHxi2Q1iVSSk0kZt0C5QSwwBKwzEofhJ8CBvakemU=",
|
||||
"last_login": null,
|
||||
"is_superuser": true,
|
||||
"username": "admin",
|
||||
"first_name": "",
|
||||
"last_name": "",
|
||||
"email": "admin@email.com",
|
||||
"is_staff": true,
|
||||
"is_active": true,
|
||||
"date_joined": "2023-08-31T10:14:33.235Z",
|
||||
"groups": [],
|
||||
"user_permissions": []
|
||||
}
|
||||
}
|
||||
]
|
||||
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Loading…
Reference in New Issue
Block a user