css transition, animation에서 사용 가능한 timing function을 만들게 해주는 사이트
https://www.youtube.com/watch?v=8cupCFknL4Q&list=PLEsfXFp6DpzRcd-q4vR5qAgOZUuz8041S&index=17
와 https://www.youtube.com/watch?v=M-4xmVk6xrg&index=18&list=PLEsfXFp6DpzRcd-q4vR5qAgOZUuz8041S
의 내용 참조
기본적으로 settings.py에
STATIC_URL = ’/static/’
STATIC_ROOT= os.path.join(BASE_DIR, ‘mysite/static/root’)
STATICFILES_DIRS = [os.path.join(BASE_DIR, ‘mysite/static/url/snowboard’),
]
의 내용이 있다.
STATIC_URL은 실제 웹페이지 내용중에 사용되게 될 경로
STATIC_ROOT은 python manage.py collectstatic 을 통해 화일들이 최종 이동하게될 위치
STATICFILES_DIRS 은 개발자가 static files을 보관하는 곳.
python manage.py runserver 를 통해 임시로 내용 확인
1. python manage.py collectstatic
명령을 통해 static화일을 STATIC_ROOT로 옮긴다.
2. git add .
3. git commit -m “기입할내용”
4. git push heroku master
heroku로 화일 올림
https://devcenter.heroku.com/articles/getting-started-with-python#introduction
heroku 설명 웹사이트와 https://www.youtube.com/watch?v=WaICRuGJnGY
django heroku depoly tutorial을 참조해서 얻은 정보이다.
1. 기본적으로 필요한 프로그램 등을 확인후 설치한다.
2. heroku cli 를 설치한다.
3. heroku login을 통해 heroku계정에 접속한다.
4. deploy 하려는 django app 폴더로 이동한다. manage.py가 있는 폴더로 이동. 그 폴더 안에는 Procfile, requirements.txt 화일이 있어야 한다.
Procfile내용
web: gunicorn <마이사이트 즉 앱이름>.wsgi –log-file –
requirements.txt 내용
dj-database-url==0.4.0 Django==1.9.2 gunicorn==19.4.5 psycopg2==2.6.1 whitenoise==2.0.6
5. manage.py가 있는 폴더에서 heroku create 명령을 친다.
6. git add .
7. git commit -m “기입할내용”
8. git push heroku master
실제 heroku로 화일 올리는 작업.
9. The application is now deployed. Ensure that at least one instance of the app is running:
heroku ps:scale web=1
명령을 친다.
10. 웹브라우저로 잘 작동하는지 확인한다.
1. virtualenv화일,폴더들을 다운 받아 압축해제한다. (godaddy 에서 sudo를 사용할수 없으므로 virtualenv를 사용한다.)
2. 그 화일,폴더들을 가상 공간으로 사용할 곳에 upload 한다.
3. SSH putty를 이용. 해당 폴더로 이동간다. python virtualenv.py VE ( VE 는 가상공간의 이름) 를 통해 가상 공간을 만든다.
4. VE/bin 안으로 이동한다. 그안에서 source activate 를 친다. 그럼 가상 python 환경으로 들어 가게 된다.
5. pip install django 명령을 통해 django 버전 1.6 을 설치한다.
http://stackoverflow.com/questions/12658427/installing-a-django-site-on-godaddy 두번째 대답을 참조한 내용. 단 godaddy의 경우 python 2.6를 지원하며 이는 django 1.6 과 호환되므로 설치시 버전 명기.
Installing a django site on GoDaddy – Stack Overflow
For future reference, as I assume you have moved on…
It is possible to use Django on GoDaddy hosting, using VirtualEnv as they recommend. Python 2.7 is natively installed and works fine, though it isn’t the default version to be run.
Enable SSH access on your site.
Use the hosting panel to setup your intial MySQL database. It doesn’t need any entries, just make sure it exists and note down the connection info.
SSH in, download VirtualEnv.py. You may get the entire tarball, but you only need the single file.
Run ’/usr/bin/python2.7 virtualenv.py –system-site-packages your_new_env’
Run ‘source your_new_env/bin/activate’
Run ‘pip install django’
You can now follow the django tutorials directly, except of course not using runserver (as you already have a webserver running)
This works for me on a deluxe account, though I would still recommend that anyone who definitely wants to use Django seek alternate hosting. GoDaddy is not very friendly, and I am not certain that everything will continue to work.
EDIT
I realized there may also be some confusion in how to get Django running normally inside Apache, without the regular mod_* options. This was my approach:
Create your django project somewhere outside of the html directory structure. For example run django-admin in ~/code to create ~/code/yoursite
Follow the normal project and database setup as described in the Django tutorials.
From your virtual python environment, run ‘pip install flup’.
Create the following script ‘django_cgi.py’ inside ~/code (Note the python path!):
#!~/your_new_env/bin/python
import sys, os
# Add a custom Python path for your project
sys.path.insert(0, “/must/be/full/path/to/code/yoursite”)
# Set the DJANGO_SETTINGS_MODULE environment variable.
# This should match the name for the project you added to the path above
os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘yoursite.settings’
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method=“threaded”, daemonize=“false”)
Inside ~/html, create or edit the .htaccess file with some variant of the following:
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/mysite.cgi
RewriteRule ^(.*)$ /mysite.cgi [QSA,L,PT]
Finally, create ~/html/mysite.cgi as follows:
#!/bin/sh
~/your_new_env/bin/python ~/code/django_cgi.py 2>&1
Ensure everything is chmod’ed appropriately (755)
This is over simplified but functional, and should result in every request for any page or file being passed off to Django.
The reason for this runaround is that GoDaddy provides only native CGI support for old versions of Python we can’t use, so we must use our virtual environment. While we cannot use that directly in the CGI scripts, we can fortunately run a shell script and invoke it manually. The mod_rewrite rule just ensures all traffic goes through Django.
References
Django with FastCGI
Start of Django Tutorials
VirtualEnv