Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file added Compressed file.zip
Binary file not shown.
Binary file added Django_0917.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions Django_Deploy/CSV_SQLite.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
##Create dataset
## Create dataset
```
( echo 'a,b,c' ; echo '1,2,3' ) > somedata.csv
```
##Import CSV
## Import CSV
```
sqlite3 database.sqlite3
.mode csv
.import somedata.csv sometable
```
##Select data
## Select data
```
SELECT * FROM sometable;
```
##SQL Script Convert SQLite3
## SQL Script Convert SQLite3
```
sqlite3 database.sqlite3 < db.sql
```
18 changes: 9 additions & 9 deletions Django_Deploy/Django_Service_Deploy.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#Deploy Django 1.7 with Python3 on Azure Ubuntu 14.04
# Deploy Django 1.7 with Python3 on Azure Ubuntu 14.04

##Virtual Environment
###python2
## Virtual Environment
### python2
```
sudo apt-get update
sudo apt-get install python-pip apache2 libapache2-mod-wsgi
```
###python3
### python3
```
sudo apt-get update
sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
```

###Configure Virtual Environment
### Configure Virtual Environment
```
sudo pip install virtualenv
mkdir myproject
Expand All @@ -21,17 +21,17 @@ virtualenv myprojectenv
source myprojectenv/bin/activate
```

###Create Django Project
### Create Django Project
```
pip install "django<1.8"
django-admin.py startproject myproject
```
###Add a line to configure this directory.
### Add a line to configure this directory.
```
nano myproject/settings.py
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
```
###Complete initial project
### Complete initial project
```
cd mysite
./manage.py makemigrations
Expand All @@ -41,7 +41,7 @@ cd mysite
./manage.py runserver 0.0.0.0:8000
```

##Apache
## Apache
```
sudo nano /etc/apache2/sites-available/000-default.conf
```
Expand Down
4 changes: 2 additions & 2 deletions Django_Deploy/PostgreSQL Troubleshooting
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
####PostgreSQL Command Line and issue
##Drop Database Issue
#### PostgreSQL Command Line and issue
## Drop Database Issue
```
REVOKE CONNECT ON DATABASE TARGET_DB FROM public;
SELECT pg_terminate_backend(pg_stat_activity.pid)
Expand Down
16 changes: 8 additions & 8 deletions Django_Deploy/Service_Deploy_REST_Framework_PostgreSQL.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
####Installing Django Rest Framework with PostgreSQL on Ubuntu 14.04
#### Installing Django Rest Framework with PostgreSQL on Ubuntu 14.04

##Setting Python Version
## Setting Python Version
```
alias python='usr/bin/python3.4'
. ~/.bashrc
python --version
```
##Installing PostgreSQL (9.3.11)
## Installing PostgreSQL (9.3.11)
```
sudo apt-get install postgresql
sudo apt-get install pgadmin3
sudo passwd postgres
sudo su postgres
sudo service postgresql restart
```
##Setting PostgreSQL
## Setting PostgreSQL
```
vi etc/postgresql/9.3/main/postgresql.conf
listen_addresses = '*'
Expand All @@ -24,7 +24,7 @@ password_encryption = on
vi /etc/postgresql/9.3/main/pg_hba.conf
host all all 0.0.0.0/0 password
```
##Installing Django
## Installing Django
# djangorestframework 3.3.3
```
sudo apt-get install python-pip
Expand All @@ -35,12 +35,12 @@ sudo pip install djangorestframework
sudo pip install markdown
sudo pip install django-filter
```
##Installing Apache Server
## Installing Apache Server
```
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
```
##Setting Django
## Setting Django

```
cd /var/www
Expand All @@ -63,7 +63,7 @@ urlpatterns = patterns('',
url(r'^$', index),
)
```
##Setting Apache Sites-available
## Setting Apache Sites-available
```
vi /etc/apache2/sites-available/000-default.conf
```
Expand Down
Binary file added Django_app.zip
Binary file not shown.