By Sheldon L | Published at 2020-02-11 | Updated at 2020-02-11 |
Open PythonAnywhere Console;
tools and ven
python3 --version
mkvirtualenv django3 --python=/usr/bin/python3.7
workon django3
pip install django
python3 -m django --version
mkdir djProjects
cd djProjects
git clone https://github.com/csev/dj4e-samples
cd dj4e-samples
pip install -r requirements.txt
python manage.py check
python manage.py makemigrations
python manage.py migrate
python3 manage.py createsuperuser
python3 manage.py runscript gview_load
python3 manage.py runscript many_load
cd ~/djProjects
django-admin startproject mysite
vim ~/djProjects/mysite/mysite/settings.py
"""/ upate ALLOWED_HOSTS
ALLOWED_HOSTS = ['*']
"""
cd ~/djProjects/mysite
python manage.py check
web
tabadd a new web application
, manually
, get settings done
/home/SheldonLee/djProjects/mysite
/home/SheldonLee/djProjects/mysite
/home/SheldonLee/.virtualenvs/django3
/var/www/..._..._..._com_wsgi.py
like this:import os
import sys
path = os.path.expanduser('~/djProjects/mysite')
if path not in sys.path:
sys.path.insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())
click reload ....pythonanywhere.com
click my url sheldonlee.pythonanywhere.com
cd ~/djProjects
git init
# after create an empty ropo on github:
git remote add origin git@github.com:sheldonldev/djProjects_onPyAnyw.git
git add .
git commit -a
ssh-keygen -t rsa -C my_email@domain.com
cat ~/.ssh/id_rsa.pub
git push --set-upstream origin master
cd $hub/mysite_test
git clone git@github.com:sheldonldev/djProjects_onPyAnyw.git
export all_proxy=socks5://127.0.0.1:1080
conda create --name dj_py37 python=3.7
conda activate dj_py37
export all_proxy=""
pip install pysocks
export all_proxy=socks5://127.0.0.1:1080
pip install django
pyCharm
:
dj_py37
;django support
in language and framework
;New
- .ignor file
- .gitignore
;pip freeze -> requirements.txt
git add .
git commit -a
git push
syncro github to PythonAnywhere
cd ~/djProject
git pull
workon django3
pip install requirements.txt
git stash
git pull
git stash apply
git add .
git merge
git pull
reload application in the Web
tab and visit it.