Skip to content

Commit

Permalink
added setting up instructions in README
Browse files Browse the repository at this point in the history
  • Loading branch information
prshnt19 committed Apr 17, 2020
1 parent 834358b commit ca4d483
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 1 deletion.
81 changes: 81 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,87 @@ We use submodules to include external libraries in sympy-live::
This is sufficient to clone appropriate repositories in correct versions
into sympy-live (see git documentation on submodules for information).

Setting Up for Testing PR 144
-----------------------------
Here are the steps to be followed for testing the PR
https://github.com/sympy/sympy-live/pull/144. The following are
the steps to be followed for Ubuntu. The steps for other Operating Systems
could be reproduced similiarly.

You must have python3 installed. You can check your version by::

$ python3 -V

The version must be greater than 3.4. If not present you can install it by::

$ sudo apt install python3

You need to create the virtual environment and activate it::

$ sudo apt-get install python3-venv
$ python3 -m venv env
$ source env/bin/activate

SymPy Live uses MySQL for database purpose. So you need to setup mysql::

$ sudo apt-get install mysql-server
$ sudo apt-get install libmysqlclient-dev
$ sudo apt-get install python3-dev
$ sudo systemctl start mysql
$ sudo mysql

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}::

mysql> CREATE DATABASE {database_name};
mysql> CREATE USER '{user_name}'@'localhost' IDENTIFIED BY '{user_password}';
mysql> FLUSH PRIVILEGES;
mysql> GRANT ALL PRIVILEGES ON *.* TO '{user_name}'@'localhost' IDENTIFIED BY '{user_password}';

These are the steps for MySQL v8.0.19. The above steps could be bit different for
you depending on the version of MySQL. You can check the MySQL documentation for
help. Using MySQL is not a compulsion. You can use any other DataBase for testing
but you must properly configure it.

To ensure that the database server launches after a reboot, run the following command::

$ sudo systemctl enable mysql

Now in settings.py set up the database for MySQL::

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '127.0.0.1', # DataBase's IP address
'PORT': '3306',
'NAME': '{database_name}',
'USER': '{user_name}',
'PASSWORD': '{user_password}',
}
}

Install dependencies from requirements.txt::

$ pip install -r requirements.txt

Migrate the changes so that all DataBase tables are created::

$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py createsuperuser # Admin. It will be used to login into admin panel

And finally you need to run the server::

$ python3 manage.py runserver

This runs the site on localhost. But before using the SymPy Live go to
admin panel http://127.0.0.1:8000/admin/. Login using the Admin details.
There you need to create new user 'anonymous'. You can keep password
anything but name must be exactly same as 'anonymous'.

Congratulations, now you can test the SymPy Live.

Development server
------------------

Expand Down
1 change: 1 addition & 0 deletions shell/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ def index(request):

context = {
# 'server_software': os.environ['SERVER_SOFTWARE'],
'hosted_on_app_engine': os.getenv('GAE_APPLICATION', None),
'application_version': LIVE_VERSION,
'date_deployed': LIVE_DEPLOYED,
'python_version': sys.version,
Expand Down
2 changes: 1 addition & 1 deletion sympy_live/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '127.0.0.1', # DB's IP address
'HOST': '127.0.0.1', # DataBase's IP address
'PORT': '3306',
'NAME': 'sympyDB',
'USER': 'root',
Expand Down
21 changes: 21 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>{% block title %}{% endblock %}</title>
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" type="text/css" />
{% if hosted_on_app_engine %}
<link rel="stylesheet" href="/static-{{application_version}}/external/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/static-{{application_version}}/external/css/responsive-gs-12col.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/static-{{application_version}}/css/base.css" type="text/css" media="screen" />
Expand All @@ -19,6 +20,22 @@
<link rel="stylesheet" type="text/css" href="static-{{application_version}}/sympy-live/css/live-core.css" />
<script type="text/javascript" src="static-{{application_version}}/sympy-live/javascript/live-autocomplete.js"></script>
<script type="text/javascript" src="static-{{application_version}}/sympy-live/javascript/live-core.js"></script>
{% else %}
<link rel="stylesheet" href="/static/external/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/static/external/css/responsive-gs-12col.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/static/css/base.css" type="text/css" media="screen" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700|Gentium+Basic" rel="stylesheet" type="text/css" />
<link rel="icon" href="/static/SymPy-Favicon.ico" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="/static/javascript/main.js"></script>
<script type="text/javascript" src="static/external/javascript/classy.js"></script>
<script type="text/javascript" src="static/sympy-live/javascript/utilities.js"></script>
<script type="text/javascript" src="static/sympy-live/javascript/expand_right.js"></script>
<link rel="stylesheet" href="static/sympy-live/css/live-autocomplete.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="static/sympy-live/css/live-core.css" />
<script type="text/javascript" src="static/sympy-live/javascript/live-autocomplete.js"></script>
<script type="text/javascript" src="static/sympy-live/javascript/live-core.js"></script>
{% endif %}

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -66,7 +83,11 @@
<body>
<div class="container">
<header>
{% if hosted_on_app_engine %}
<h1><a href="/"> <img src="/static-{{application_version}}/images/logo.png" alt="SymPy Logo" /> SymPy</a></h1>
{% else %}
<h1><a href="/"> <img src="/static/images/logo.png" alt="SymPy Logo" /> SymPy</a></h1>
{% endif %}
<div id="mobile-menu"><i class="icon-ellipsis-vertical"></i></div>
</header>
<nav id="main-navigation" class="row">
Expand Down

0 comments on commit ca4d483

Please sign in to comment.