Skip to content

Commit 07fa62f

Browse files
committed
added setting up instructions in README
1 parent 834358b commit 07fa62f

File tree

4 files changed

+89
-1
lines changed

4 files changed

+89
-1
lines changed

README.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,72 @@ We use submodules to include external libraries in sympy-live::
4848
This is sufficient to clone appropriate repositories in correct versions
4949
into sympy-live (see git documentation on submodules for information).
5050

51+
Setting Up for Testing PR 144
52+
-----------------------------
53+
54+
You must have python3 installed. You can check your version by::
55+
56+
$ python3 -V
57+
58+
The version must be greater than 3.4. If not present you can install it by::
59+
60+
$ sudo apt install python3
61+
62+
You need to create the virtual environment and activate it::
63+
64+
$ sudo apt-get install python3-venv
65+
$ python3 -m venv env
66+
$ source env/bin/activate
67+
68+
SymPy Live uses MySQL for database purpose. So you need to setup mysql::
69+
70+
$ sudo apt-get install mysql-server
71+
$ sudo apt-get install libmysqlclient-dev
72+
$ sudo apt-get install python3-dev
73+
$ sudo systemctl start mysql
74+
$ sudo mysql
75+
76+
This will open mysql. You will now have to create a new database with name {database_name}. Create a new user {user_name} and password {user_password}. Grant all previleges to <user_name> on {database-name}::
77+
78+
mysql> CREATE DATABASE {database_name};
79+
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('{user_password}') WHERE User = '{user_name}';
80+
mysql> FLUSH PRIVILEGES;
81+
mysql> GRANT ALL PRIVILEGES ON *.* TO '{user_name}'@'localhost' IDENTIFIED BY '{user_password}';
82+
83+
To ensure that the database server launches after a reboot, run the following command::
84+
85+
$ sudo systemctl enable mysql
86+
87+
Now in settings.py set up the database for MySQL::
88+
89+
DATABASES = {
90+
'default': {
91+
'ENGINE': 'django.db.backends.mysql',
92+
'HOST': '127.0.0.1', # DB's IP address
93+
'PORT': '3306',
94+
'NAME': '{database_name}',
95+
'USER': '{user_name}',
96+
'PASSWORD': '{user_password}',
97+
}
98+
}
99+
100+
Install dependencies from requirements.txt::
101+
102+
$ pip install -r requirements.txt
103+
104+
migrate the changes::
105+
106+
$ python3 manage.py makemigrations
107+
$ python3 manage.py migrate
108+
$ python3 manage.py createsuperuser # will be used to login into admin panel
109+
110+
And fianlly::
111+
112+
$ python3 manage.py runserver
113+
114+
This runs the site on localhost. But before using the SymPy Live go to admin panel. There you need to create new user 'anonymous'. You can keep password anythong but name must be exactly same.
115+
Congratulations, now you can test the SymPy Live.
116+
51117
Development server
52118
------------------
53119

shell/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ def index(request):
677677

678678
context = {
679679
# 'server_software': os.environ['SERVER_SOFTWARE'],
680+
'hosted_on_app_engine': os.getenv('GAE_APPLICATION', None),
680681
'application_version': LIVE_VERSION,
681682
'date_deployed': LIVE_DEPLOYED,
682683
'python_version': sys.version,

sympy_live/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
DATABASES = {
106106
'default': {
107107
'ENGINE': 'django.db.backends.mysql',
108-
'HOST': '127.0.0.1', # DB's IP address
108+
'HOST': '127.0.0.1', # DB's IP address
109109
'PORT': '3306',
110110
'NAME': 'sympyDB',
111111
'USER': 'root',

templates/base.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
66
<title>{% block title %}{% endblock %}</title>
77
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" type="text/css" />
8+
{% if hosted_on_app_engine %}
89
<link rel="stylesheet" href="/static-{{application_version}}/external/css/reset.css" type="text/css" media="screen" />
910
<link rel="stylesheet" href="/static-{{application_version}}/external/css/responsive-gs-12col.css" type="text/css" media="screen" />
1011
<link rel="stylesheet" href="/static-{{application_version}}/css/base.css" type="text/css" media="screen" />
@@ -19,6 +20,22 @@
1920
<link rel="stylesheet" type="text/css" href="static-{{application_version}}/sympy-live/css/live-core.css" />
2021
<script type="text/javascript" src="static-{{application_version}}/sympy-live/javascript/live-autocomplete.js"></script>
2122
<script type="text/javascript" src="static-{{application_version}}/sympy-live/javascript/live-core.js"></script>
23+
{% else %}
24+
<link rel="stylesheet" href="/static/external/css/reset.css" type="text/css" media="screen" />
25+
<link rel="stylesheet" href="/static/external/css/responsive-gs-12col.css" type="text/css" media="screen" />
26+
<link rel="stylesheet" href="/static/css/base.css" type="text/css" media="screen" />
27+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700|Gentium+Basic" rel="stylesheet" type="text/css" />
28+
<link rel="icon" href="/static/SymPy-Favicon.ico" />
29+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
30+
<script type="text/javascript" src="/static/javascript/main.js"></script>
31+
<script type="text/javascript" src="static/external/javascript/classy.js"></script>
32+
<script type="text/javascript" src="static/sympy-live/javascript/utilities.js"></script>
33+
<script type="text/javascript" src="static/sympy-live/javascript/expand_right.js"></script>
34+
<link rel="stylesheet" href="static/sympy-live/css/live-autocomplete.css" type="text/css" />
35+
<link rel="stylesheet" type="text/css" href="static/sympy-live/css/live-core.css" />
36+
<script type="text/javascript" src="static/sympy-live/javascript/live-autocomplete.js"></script>
37+
<script type="text/javascript" src="static/sympy-live/javascript/live-core.js"></script>
38+
{% endif %}
2239

2340
<script type="text/x-mathjax-config">
2441
MathJax.Hub.Config({
@@ -66,7 +83,11 @@
6683
<body>
6784
<div class="container">
6885
<header>
86+
{% if hosted_on_app_engine %}
6987
<h1><a href="/"> <img src="/static-{{application_version}}/images/logo.png" alt="SymPy Logo" /> SymPy</a></h1>
88+
{% else %}
89+
<h1><a href="/"> <img src="/static/images/logo.png" alt="SymPy Logo" /> SymPy</a></h1>
90+
{% endif %}
7091
<div id="mobile-menu"><i class="icon-ellipsis-vertical"></i></div>
7192
</header>
7293
<nav id="main-navigation" class="row">

0 commit comments

Comments
 (0)