Skip to content

Commit 2c12def

Browse files
committed
django migrate
0 parents  commit 2c12def

File tree

5,738 files changed

+609362
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,738 files changed

+609362
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# `Django`를 공부하자
2+
현재 `Youtube`, `Instagram``django`가 기반인 프로젝트가 많습니다
3+
어떻게 진행하는지 궁금하다면? [장고 튜토리얼](https://docs.djangoproject.com/en/2.1/intro/tutorial01/)
4+
5+
`mysite` 폴더 만들자
6+
```console
7+
root@goorm:/workspace/django# mkdir mysite
8+
```
9+
10+
`mysite` 폴더로 들어가자
11+
```console
12+
root@goorm:/workspace/django# cd mysite
13+
```
14+
15+
`pip3`를 이용해 `virtualenv`를 다운로드하자
16+
가상환경을 설정합니다. 프로젝트 관리를 편하게 해줍니다
17+
자세한 내용은 검색을 해보자 이 문서는 튜토리얼이니 실습에 맞춰져 있습니다
18+
19+
```console
20+
root@goorm:/workspace/django/mysite# pip3 install virtualenv
21+
```
22+
23+
가상환경 설정을 위해 `virtualenv``mysite/myvenv` 폴더에 설치합니다
24+
`/bin`, `/include`, `/lib` 폴더가 설치됩니다
25+
```console
26+
root@goorm:/workspace/django/mysite# virtualenv myvenv
27+
```
28+
29+
설정한 가상환경을 실행합니다
30+
**프로젝트를 실행할때마다 반복해서 사용하는 명령어입니다**
31+
```console
32+
root@goorm:/workspace/django/mysite# source myvenv/bin/activate
33+
```
34+
django 프로젝트를 설치합니다
35+
```console
36+
(myvenv)root@goorm:/workspace/django/mysite# pip3 install django==2.1
37+
```
38+
현재 `/django/mysite` 폴더에 `/tutorialdiango` 프로젝트를 생성합니다
39+
`/tutorialdjango` 폴더와 `manage.py`가 생성됩니다
40+
```console
41+
(myvenv) root@goorm:/workspace/django/mysite# django-admin startproject tutorialdjango .
42+
```
43+
`django`가 사용할 DB를 생성합니다(migrate 합니다)
44+
```console
45+
(myvenv) root@goorm:/workspace/django/mysite# python manage.py migrate
46+
```

goorm.manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"storage":"container","type":"python","detailedtype":"default","author":"114601135411756706059_3yl1p_google","name":"django_3","description":"django하며 문서도 만들자","date":"2018/12/18 6:37:41","plugins":{"goorm.plugin.python":[{"plugin.python.compiler_type":"python3","plugin.python.main":"index","plugin.python.source_path":"","plugin.python.run_on":"console","plugin.python.run_option":"","plugin.python.log_path":"server.log"}]},"is_user_plugin":false,"author_email":"[email protected]","author_name":"gang min choi","ignore_patterns":[],"project_domain":[{"id":"114601135411756706059_3yl1p_google","url":"django-3-nniqi.run.goorm.io","port":"80"}]}

index.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello Python")

mysite/db.sqlite3

40 KB
Binary file not shown.

mysite/manage.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == '__main__':
6+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tutorialdjango.settings')
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError as exc:
10+
raise ImportError(
11+
"Couldn't import Django. Are you sure it's installed and "
12+
"available on your PYTHONPATH environment variable? Did you "
13+
"forget to activate a virtual environment?"
14+
) from exc
15+
execute_from_command_line(sys.argv)
Binary file not shown.

mysite/myvenv/bin/activate

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This file must be used with "source bin/activate" *from bash*
2+
# you cannot run it directly
3+
4+
deactivate () {
5+
unset -f pydoc >/dev/null 2>&1
6+
7+
# reset old environment variables
8+
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
9+
if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
10+
PATH="$_OLD_VIRTUAL_PATH"
11+
export PATH
12+
unset _OLD_VIRTUAL_PATH
13+
fi
14+
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
15+
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
16+
export PYTHONHOME
17+
unset _OLD_VIRTUAL_PYTHONHOME
18+
fi
19+
20+
# This should detect bash and zsh, which have a hash command that must
21+
# be called to get it to forget past commands. Without forgetting
22+
# past commands the $PATH changes we made may not be respected
23+
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
24+
hash -r 2>/dev/null
25+
fi
26+
27+
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
28+
PS1="$_OLD_VIRTUAL_PS1"
29+
export PS1
30+
unset _OLD_VIRTUAL_PS1
31+
fi
32+
33+
unset VIRTUAL_ENV
34+
if [ ! "${1-}" = "nondestructive" ] ; then
35+
# Self destruct!
36+
unset -f deactivate
37+
fi
38+
}
39+
40+
# unset irrelevant variables
41+
deactivate nondestructive
42+
43+
VIRTUAL_ENV="/workspace/django_3/mysite/myvenv"
44+
export VIRTUAL_ENV
45+
46+
_OLD_VIRTUAL_PATH="$PATH"
47+
PATH="$VIRTUAL_ENV/bin:$PATH"
48+
export PATH
49+
50+
# unset PYTHONHOME if set
51+
if ! [ -z "${PYTHONHOME+_}" ] ; then
52+
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
53+
unset PYTHONHOME
54+
fi
55+
56+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
57+
_OLD_VIRTUAL_PS1="$PS1"
58+
if [ "x" != x ] ; then
59+
PS1="$PS1"
60+
else
61+
PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
62+
fi
63+
export PS1
64+
fi
65+
66+
# Make sure to unalias pydoc if it's already there
67+
alias pydoc 2>/dev/null >/dev/null && unalias pydoc
68+
69+
pydoc () {
70+
python -m pydoc "$@"
71+
}
72+
73+
# This should detect bash and zsh, which have a hash command that must
74+
# be called to get it to forget past commands. Without forgetting
75+
# past commands the $PATH changes we made may not be respected
76+
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
77+
hash -r 2>/dev/null
78+
fi

mysite/myvenv/bin/activate.csh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file must be used with "source bin/activate.csh" *from csh*.
2+
# You cannot run it directly.
3+
# Created by Davide Di Blasi <[email protected]>.
4+
5+
set newline='\
6+
'
7+
8+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
9+
10+
# Unset irrelevant variables.
11+
deactivate nondestructive
12+
13+
setenv VIRTUAL_ENV "/workspace/django_3/mysite/myvenv"
14+
15+
set _OLD_VIRTUAL_PATH="$PATH:q"
16+
setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
17+
18+
19+
20+
if ("" != "") then
21+
set env_name = ""
22+
else
23+
set env_name = "$VIRTUAL_ENV:t:q"
24+
endif
25+
26+
# Could be in a non-interactive environment,
27+
# in which case, $prompt is undefined and we wouldn't
28+
# care about the prompt anyway.
29+
if ( $?prompt ) then
30+
set _OLD_VIRTUAL_PROMPT="$prompt:q"
31+
if ( "$prompt:q" =~ *"$newline:q"* ) then
32+
:
33+
else
34+
set prompt = "[$env_name:q] $prompt:q"
35+
endif
36+
endif
37+
38+
unset env_name
39+
40+
alias pydoc python -m pydoc
41+
42+
rehash

mysite/myvenv/bin/activate.fish

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
2+
# Do not run it directly.
3+
4+
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
5+
# reset old environment variables
6+
if test -n "$_OLD_VIRTUAL_PATH"
7+
set -gx PATH $_OLD_VIRTUAL_PATH
8+
set -e _OLD_VIRTUAL_PATH
9+
end
10+
11+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
12+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
13+
set -e _OLD_VIRTUAL_PYTHONHOME
14+
end
15+
16+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
17+
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
18+
set -l fish_function_path
19+
20+
# Erase virtualenv's `fish_prompt` and restore the original.
21+
functions -e fish_prompt
22+
functions -c _old_fish_prompt fish_prompt
23+
functions -e _old_fish_prompt
24+
set -e _OLD_FISH_PROMPT_OVERRIDE
25+
end
26+
27+
set -e VIRTUAL_ENV
28+
29+
if test "$argv[1]" != 'nondestructive'
30+
# Self-destruct!
31+
functions -e pydoc
32+
functions -e deactivate
33+
end
34+
end
35+
36+
# Unset irrelevant variables.
37+
deactivate nondestructive
38+
39+
set -gx VIRTUAL_ENV "/workspace/django_3/mysite/myvenv"
40+
41+
set -gx _OLD_VIRTUAL_PATH $PATH
42+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
43+
44+
# Unset `$PYTHONHOME` if set.
45+
if set -q PYTHONHOME
46+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
47+
set -e PYTHONHOME
48+
end
49+
50+
function pydoc
51+
python -m pydoc $argv
52+
end
53+
54+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
55+
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
56+
functions -c fish_prompt _old_fish_prompt
57+
58+
function fish_prompt
59+
# Save the current $status, for fish_prompts that display it.
60+
set -l old_status $status
61+
62+
# Prompt override provided?
63+
# If not, just prepend the environment name.
64+
if test -n ""
65+
printf '%s%s' "" (set_color normal)
66+
else
67+
printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
68+
end
69+
70+
# Restore the original $status
71+
echo "exit $old_status" | source
72+
_old_fish_prompt
73+
end
74+
75+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
76+
end

0 commit comments

Comments
 (0)