jone 마이그레이션
[패키지 설치]
source 가상환경에서
pip freeze >> requirement.txt
target 가상환경에서
pip install -r requirement.txt
[django-responsive2 설정변경]
cp $HOME/.virtualenvs/jone/lib/python3.6/site-packages/responsive/middleware.py $HOME/.virtualenvs/jone3/lib/python3.6/site-packages/responsive/middleware.py
cp $HOME/.virtualenvs/jone/lib/python3.6/site-packages/responsive/context_processors.py $HOME/.virtualenvs/jone3/lib/python3.6/site-packages/responsive/context_processors.py
[장고 설치]
cd $HOME
django-admin startproject jone3
cp -R /ubuntu/home/jone/bin /ubuntu/home/jone3/bin
mkdir $PRJ_HOME/log
cp -R /home/ubuntu/jone/data /home/ubuntu/jone3/data
cp -R /home/ubuntu/jone/templates /home/ubuntu/jone3/templates
[project Settings.py 복사 및 설정]
cp /home/ubuntu/jone3/jone3/settings.py /home/ubuntu/jone3/jone3/settings.org
cp /home/ubuntu/jone/jone/settings.py /home/ubuntu/jone3/jone3/settings.py
change settings.py for target
- project name (jone -> jone3)
- secret_key
- database
[project urls.py 복사 및 수정]
cp /home/ubuntu/jone3/jone3/urls.py /home/ubuntu/jone3/jone3/urls.org
cp /home/ubuntu/jone/jone/urls.py /home/ubuntu/jone3/jone3/urls.py
urls.py에서 아래 두줄을 코멘트 처리
urlpatterns = [
# path('', include('homepage.urls')),
# path('homepage/', include('homepage.urls')),
path('ckeditor/', include('ckeditor_uploader.urls')),
path('filer/', include('filer.urls')),
path('admin/', admin.site.urls),
path('robots.txt/', TemplateView.as_view(template_name="robots.txt", content_type='text/plain'))
]
(관리자 id 생성)
[homepage app 만들기]
cd $PRJ_HOME
python manage.py startapp homepage
[사용자 마이크레이션]
1. user 정보 이관
source$ python manage.py dumpdata auth.user > auth_user.json
target$ python manage.py loaddata auth_user.json
2. codegroup, code만 모델생성
cd $PRJ_HOME/homepage
cp ../../jone/homepage/models.py models.full
cp models.full models.py
vi models.py
Codegroup, Code 모델만 남기고 다 지운다.
cp ../../jone/homepage/utils.py .
mk.sh
mg.sh
3. codegroup, code 데이터 이관
source$ python manage.py dumpdata homepage. homepage > homepage_codegroup.json
target$ python manage.py loaddata homepage_codegroup.json
source$ python manage.py dumpdata homepage.code > homepage_code.json
target$ python manage.py loaddata homepage_code.json
4. codegroup, code외 모델 전체 생성
cp models.full models.py
mk.sh
mg.sh
5. codegroup, code외 데이터 이관
content
related
smsrelated
authsms
questiondb
userdb
6. homepage 소스 이관
models.py
views.py
admin.py
urls.py
forms.py
utils.py
djutils.py
static/*
templates/*
templatetags/*
7. staticfiles, mediafiles 이관
8. uwsgi 설정
9. project's urls.py 변경
urls.py에서 아래 빨간 두줄을 코멘트 지움
urlpatterns = [
path('', include('homepage.urls')),
path('homepage/', include('homepage.urls')),
path('ckeditor/', include('ckeditor_uploader.urls')),
path('filer/', include('filer.urls')),
path('admin/', admin.site.urls),
path('robots.txt/', TemplateView.as_view(template_name="robots.txt", content_type='text/plain'))
]
오픈
댓글
댓글 쓰기