-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdjango_to_python
More file actions
36 lines (30 loc) · 1.13 KB
/
django_to_python
File metadata and controls
36 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!usr/bin/python
import os
os.system('yum -y install python-pip')
os.system('pip install virtualenv')
os.system('pip install --upgrade pip')
##mkdir and cd into
os.mkdir('/opt/django')
os.chdir('/opt/django/')
##running python 2 but want 3.6
os.system('yum -y install python36')
os.system('virtualenv -p python36 django')
print("Good-to-Go")
os.system('source /opt/django/django/bin/activate && pip install django')
print("Good-to-Go")
##still in 2.7.5 && need to source to 3.6
os.chdir('/opt/django')
print("Good-to-Go")
os.system('source /opt/django/django/bin/activate ' + \
'&& django-admin --version ' + \
'&& django-admin startproject project1')
print("Good-to-Go")
##start project
##change ownership from root to a user
os.system('chown -R g42dfyt /opt/django') ##if you don't know this--: who
print("Good-to-Go")
os.system('chown -R g42dfyt /opt/django/project1')
print("Good-to-Go")
os.system('sudo -u g42dfyt sh -c "source /opt/django/django/bin/activate && python /opt/django/project1/manage.py runserver 0.0.0.0:8000&" ')
print("Good-to-Go")
##activate django install and run server