[Github]
1. download
- https://desktop.github.com/
2. install Github desktop
3. set clone
4. set ignore files cofigure
5. commit and upload
[PythonAnywhere]
1. Login or register
2. open Bash console
06:03 ~ $ 06:03 ~ $ pwd/home/redrain06:03 ~ $ python --versionPython 2.7.1206:03 ~ $ python3 --versionPython 3.7.006:03 ~ $
3. Upload Git setting
- copy git address
- set address in PythonAnywhere
06:08 ~ $ git clone https://github.com/RedRainKim/DevBlog.gitCloning into 'DevBlog'...remote: Counting objects: 31, done.remote: Compressing objects: 100% (26/26), done.remote: Total 31 (delta 1), reused 31 (delta 1), pack-reused 0Unpacking objects: 100% (31/31), done.Checking connectivity... done.06:08 ~ $
4. update (change source code)
06:11 ~/DevBlog (master)$ git pullAlready up-to-date.06:11 ~/DevBlog (master)$
5. tree
06:11 ~/DevBlog (master)$ tree.├── blog│ ├── __init__.py│ ├── admin.py│ ├── apps.py│ ├── forms.py│ ├── migrations│ │ ├── 0001_initial.py│ │ └── __init__.py│ ├── models.py│ ├── static│ │ └── css│ │ └── blog.css│ ├── templates│ │ └── blog│ │ ├── base.html│ │ ├── post_detail.html│ │ ├── post_edit.html│ │ └── post_list.html│ ├── tests.py│ ├── urls.py│ └── views.py├── manage.py└── mysite ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py7 directories, 20 files06:12 ~/DevBlog (master)$
6. virtual environment
06:17 ~/DevBlog (master)$ python3 --versionPython 3.7.0 06:18 ~/DevBlog (master)$ virtualenv --python=python3.6 myvenv Running virtualenv with interpreter /usr/bin/python3.6 Using base prefix '/usr' New python executable in /home/redrain/DevBlog/myvenv/bin/python3.6 Also creating executable in /home/redrain/DevBlog/myvenv/bin/python Installing setuptools, pip, wheel...done. 06:19 ~/DevBlog (master)$ 06:19 ~/DevBlog (master)$ 06:19 ~/DevBlog (master)$ source myvenv/bin/activate(myvenv) 06:19 ~/DevBlog (master)$ (myvenv) 06:19 ~/DevBlog (master)$ (myvenv) 06:19 ~/DevBlog (master)$
7. install Django
(myvenv) 06:19 ~/DevBlog (master)$ pip --versionpip 18.0 from /home/redrain/DevBlog/myvenv/lib/python3.6/site-packages/pip (python 3.6) (myvenv) 06:20 ~/DevBlog (master)$ pip install django Looking in links: /usr/share/pip-wheels Collecting django Downloading https://files.pythonhosted.org/packages/ca/7e/fc068d164b32552ae3a8f8d5d0280c083f2e8d553e71ecacc21927564561/Django-2.1.1-py3-none-any.whl (7.3MB) 100% |████████████████████████████████| 7.3MB 553kB/s Collecting pytz (from django) Installing collected packages: pytz, django Successfully installed django-2.1.1 pytz-2018.5 (myvenv) 06:23 ~/DevBlog (master)$
8. Create database
(myvenv) 06:25 ~/DevBlog (master)$ python --version Python 3.6.6 (myvenv) 06:25 ~/DevBlog (master)$ (myvenv) 06:25 ~/DevBlog (master)$ (myvenv) 06:25 ~/DevBlog (master)$ python manage.py migrate Operations to perform: Apply all migrations: admin, auth, blog, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0002_alter_permission_name_max_length... OK Applying auth.0003_alter_user_email_max_length... OK Applying auth.0004_alter_user_username_opts... OK Applying auth.0005_alter_user_last_login_null... OK Applying auth.0006_require_contenttypes_0002... OK Applying auth.0007_alter_validators_add_error_messages... OK Applying auth.0008_alter_user_username_max_length... OK Applying auth.0009_alter_user_last_name_max_length... OK Applying blog.0001_initial... OK Applying sessions.0001_initial... OK (myvenv) 06:25 ~/DevBlog (master)$ (myvenv) 06:26 ~/DevBlog (master)$ python manage.py createsuperuserUsername (leave blank to use 'redrain'): redrain Email address: kim.redrain@gmail.com Password: Password (again): Superuser created successfully.(myvenv) 06:27 ~/DevBlog (master)$
9. collect static files
(myvenv) 06:29 ~/DevBlog (master)$ python manage.py collectstatic120 static files copied to '/home/redrain/DevBlog/static'.(myvenv) 06:30 ~/DevBlog (master)$ s -lbash: s: command not found(myvenv) 06:30 ~/DevBlog (master)$ ls -ltotal 72drwxrwxr-x 6 redrain registered_users 4096 Sep 24 06:25 blog-rw-r--r-- 1 redrain registered_users 46080 Sep 24 06:27 db.sqlite3-rw-rw-r-- 1 redrain registered_users 538 Sep 24 06:08 manage.pydrwxrwxr-x 3 redrain registered_users 4096 Sep 24 06:25 mysitedrwxrwxr-x 5 redrain registered_users 4096 Sep 24 06:18 myvenvdrwxrwxr-x 4 redrain registered_users 4096 Sep 24 06:30 static(myvenv) 06:30 ~/DevBlog (master)$
10. make web
11. configure
- virtual environment set
- WSGI file setting
- reload
* when update source code (.py files) should be reload every time
댓글 없음:
댓글 쓰기