The Github Repo of My Personal Website JOSHUA's BLOG
2016-09-24 15:12
405 查看
Joshua-s-Blog
I start up this repo to manage the code of my personal website JOSHUA’s BLOG, which is set up on WebFaction and implemented by Django and several other packages. The repository is here.In addition to manage my own code, viewers can also use this project to learn how to build a website using Django. I will write down the works that need to be done to use these code.
Finally, welcome to visit JOSHUA’s BLOG.
Environment
Ubuntu 14.04. Though Ubuntu 16.04 has been released for a while, I am still using an older LTS release. I am not sure the following instruction can work fine on Ubuntu 16.04.Apache 2.4. I chose Apache 2.4 because my deploy server is powered by Apache 2.4. The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows.
WSGI 1.5. WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server communicates with web applications, and how web applications can be chained together to process one request.
Django 1.7.1. Hmm… I am still using an ancient version of Django. It is also because I wish I could have an exactly same developing environment with the deploy one. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.
Instructions
Install Apache 2.4
Apache can be installed easily using the apt-get.sudo apt-get install apache2. Then we can use
apacheclt -vto check the version of Apache and its success of installation.
Install mod_wsgi 1.5
mod_wsgi can be installed using Pip, which can be installed usingsudo apt-get install python-pip.
install mod_wsgi using
pip install mod_wsgi. I met an error of
missing Apache httpd server packages.here. I bypassed this error by
sudo apt-get install apache2-mpm-worker apache2-dev.
download mod_wsgi-3.5.tar.gz from here.
extract files from the package using
tar xvfz mod_wsgi-3.5.tar.gz.
enter the directory
cd cd mod_wsgi-3.5.
config by
./configure
make
sudo make install
Install Django 1.7.1
Install Django using commandpip install Django==1.7.1. To verify its installation, try to
import djangoin python console. If no error is raised, then the installation is successful.
Set up joshua_blog project with Apache
Note: after download the project, you should change the folder name tojoshua_blog.
add the following code to the file of
/etc/apache2/apache2.conf
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so WSGIScriptAlias / /home/joshua/CODE/PYTHON/joshua_blog/joshua_blog/wsgi.py Alias /media/ /home/joshua/CODE/PYTHON/joshua_blog/media/ Alias /static/ /home/joshua/CODE/PYTHON/joshua_blog/static/ <Directory /home/joshua/CODE/PYTHON/joshua_blog/static> Require all granted </Directory> <Directory /home/joshua/CODE/PYTHON/joshua_blog/media> Require all granted </Directory> <Directory /home/joshua/CODE/PYTHON/joshua_blog/joshua_blog> <Files wsgi.py> Require all granted </Files> </Directory> WSGIPythonPath /home/joshua/anaconda/lib/python2.7/site-packages ServerName localhost:80
add the following code to the file of
joshua_blog/joshua_blog/wsgi.py
import sys sys.path.append("/path/joshua_blog/")
in my case, the path is
/home/joshua/CODE/PYTHON/.
restart apache server by
sudo service apache2 restart
Install dependency modules
Coming here, we have set up the environment. But when we visit127.0.0.1, we found that the web server return 500 error. It is because several modules needed by joshua_blog are of need to be installed manually. We can see which modules are missed in the file of
/var/log/apache2/error.log. Next we will see how to install these modules.
django-bootstrap. The author suggests to install this app using
pip install django-bootstrap, but the latest version of the app requires Django>=1.8. Thus we need to download django-bootstrap from 6.x.x branch, which can be found here. Extract the package and enter its directory. Install by
python setup.py install.
django-filemanager. The installation instruction can be found here.
django-disqus. Install by
pip install django-disqus. A brief introduction in Chinese can be found here
unidecode. Install by
pip install unidecode.
markdown2. Install by
pip install markdown2. A brief introduction in Chinese can be found here.
At last we can visit our website at 127.0.0.1. We can log in as the supervisor using the username of
joshuaand the password of
joshua. We may meet other issues:
Here maybe we will get an error message reading “attempt to write a readonly database”. We should change its mode by
chmod 666 db.sqlite3.
Then another error comes as “unable to open database file”. Then we should change the owner of the whole project
sudo chown www-data joshua_blog.
相关文章推荐
- The first article of my Blog
- The beginning of my blog
- This is my last blog here, I'm changing the blog addr to gaowanlong.github.com
- Celebrate the opening of my CSDN Blog
- Origin of the name of my blog
- The new day of my blog
- The beginning of my blog.
- The first of my blog write in English
- The beginning of My blog
- the frist page of my blog.md
- The Opening Ceremony of my blog
- Github出现failed to sync branch You might need to open a shell and debug the state of this repo的解决方法
- The Start of my blog
- From the bottom of my broken heart
- Back Up of My Blog Page-Skin
- The Analysis of My Own Procrastination
- Matt Meleski's .Net Blog - The ABC's of .NET : Constructing BizTalk 2004 XML Messages (In an Orchestration) - Choices
- Can you explain the result of the following example? Oh, my!
- The description of GameHall and my program experience for interview
- CSDN——The Beginning Of My Tech Life