Browse Source

updated requirements.txt and README.md

dmr1725 4 years ago
parent
commit
94c08a1dca
2 changed files with 180 additions and 1 deletions
  1. 179
    1
      README.md
  2. 1
    0
      server/requirements.txt

+ 179
- 1
README.md View File

@@ -1,2 +1,180 @@
1
-Companion App
1
+**Companion App**
2 2
 
3
+**Authors**: José Alvarado, Daniel Suazo and Diego Méndez
4
+
5
+
6
+### Description of the application
7
+The purpose of the Companion App is to facilitate the course selection process for students at the UPRRP. The concept is achieved by offering a variety of tools to the user:
8
+
9
+    1. Keeping a record of the courses that the student has already taken while they progress through their degree. 
10
+
11
+    2. The app uses the data entered by the student to compute the GPA, this allows the user to keep track of it and have it handy for all academic purposes. 
12
+
13
+    3. It presents the list of classes that the university has made available for the upcoming semester. This allows the user to choose the courses that they look forward to enrolling in.
14
+
15
+    4. With the selected courses and their allocated times, the app provides the option to create an agenda with the selected courses in time-blocks organized in a weekly format.
16
+
17
+The goal is to help students organize themselves, practice their enrollments and evaluate all of their options before using the university's system for the official process.
18
+
19
+### Requirements:
20
+    - Python 3.4+
21
+    - Postgres
22
+    - PgAdmin (UI to see your database): https://www.pgadmin.org/
23
+    - Ngrok free version: https://ngrok.com/
24
+    - Postman (test endpoints): https://www.postman.com/
25
+    - npm and node: https://www.npmjs.com/get-npm
26
+    - Expo ios or android mobile app to run application in physical device
27
+    - Android studio to run application in emulator
28
+
29
+### SPECIAL NOTES BEFORE STARTING:
30
+While following the steps below, if you get the following messages:
31
+- ### Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser in your project to create one manually.
32
+- ### Watching for file changes with StatReloader
33
+Just add the word winpty at the beginning of each command. Examples:
34
+- ### winpty python manage.py createsuperuser
35
+- ### winpty python manage.py runserver
36
+
37
+
38
+**Below are the steps to run the application**
39
+
40
+### Step 1: Run in your terminal
41
+- Download the repository from this url: https://git.ccom.uprrp.edu/CCOM4030/companion_app/src/branch/master 
42
+
43
+
44
+### Step 2: Go to the server directory and run in your terminal
45
+- pip install -r requirements.txt
46
+
47
+
48
+### Step 3: Create database
49
+- Create postgres database in PgAdmin called ‘**iupi**’
50
+- Go to **server/restful/settings.py**
51
+- Go to line 130 where it says ‘**DATABASES**’ and fill your data in ‘**USER**’ and ‘**PASSWORD**’ accordingly
52
+
53
+### Step 4: change directories in files
54
+- Go to **organizar/organizar.py** and change the paths in lines 4, 5 and 6 to your path
55
+Go to **server/CompanionApp/views.py** and change paths in lines 3, 54 and 101 to your path. **NOTE: in line 54 you need to change 2 paths**
56
+
57
+
58
+### Step 5: make migrations of django project
59
+- Go to the server directory and run:
60
+    - **python manage.py makemigrations**
61
+    - **python manage.py migrate**
62
+- After running these 2 commands successfully, go to pgAdmin and go to the ‘**iupi**’ database. Then from the **iupi** database go to **Schemas/Tables**.You should see 22 tables.
63
+
64
+### Step 6: create endpoints in postman
65
+- Open postman and create a new collection called ‘**CompanionApp**’
66
+- Inside the collection ‘**CompanionApp**’ we’re going to create 3 post requests
67
+- To create a request inside a collection, just click the three dots (‘...’) of the collection ‘**CompanionApp**’ and then click ‘**Add Request**’. Enter the name of the request. Look for the request and change the ‘**GET**’ method to a ‘**POST**’ method and insert a url. 
68
+    - First request call it ‘**Insert every faculty**’. Change it to a ‘**POST**’ request. Set url to ‘**http://127.0.0.1:8000/api/insertar_fac**’
69
+    - Second request call it ‘**Insert courses**’. Change it to a ‘**POST**’ request. Set url to ‘**http://127.0.0.1:8000/api/insertar_cursos**’
70
+    - Third request call it ‘**Insert courses for next semester**’. Change it to a ‘**POST**’ request. Set url to ‘**http://127.0.0.1:8000/api/insertar_prox_sem_cursos**’ 
71
+
72
+### Step 7: insert faculties, unique courses and courses for next semester with the endpoints created in step 7
73
+- Go to the **server** directory in the terminal and type ‘**python manage.py runserver**’
74
+- Let the terminal run and go to Postman.
75
+    - Click send in the endpoint called ‘**Insert every faculty**’ and wait for it to finish.
76
+    - Then, click send in the endpoint called ‘**Insert courses**’ and wait for it to finish.
77
+    - Finally, click send in the endpoint called ‘**Insert courses for next semester**’ and wait for it to finish.
78
+- After running successfully these 3 endpoints, quit the server and go to PgAdmin and look for the database ‘**iupi**’. Go to tables “**CompanionApp_facultad**”, “**CompanionApp_curso**” and “**CompanionApp_proximosemestre**” and you should see these tables with values. 
79
+
80
+### Step 8: create django superuser
81
+- go to the server directory in the terminal and type ‘**python manage.py createsuperuser**’
82
+    - For username: ‘admin’
83
+    - For email address: ‘admin@admin.com’
84
+    - For password: ‘admin’
85
+- **You can type whatever you want in username, email and password. Just remember these credentials because we’re going to use them later on.** 
86
+- Now you can go to the **server** directory and run ‘**python manage.py runserver**’. Then go to your browser and paste this url ‘**http://127.0.0.1:8000/admin**’. Login as admin and explore django admin. 
87
+
88
+
89
+### Step 9: create site in django admin
90
+- Go to **server** directory in the terminal and type ‘**python manage.py runserver**’
91
+- Then, go this url ‘**http://127.0.0.1:8000/admin**’ and login as admin.
92
+- Once logged in, click where it says **SITES** and then click on **ADD SITE**
93
+    - Domain name: **localhost:8000**
94
+    - Display name: **localhost:8000**
95
+    - Click save
96
+
97
+
98
+### Step 10: create a social application 
99
+- Go to **server** directory in the terminal and type ‘**python manage.py runserver**’
100
+- Then, go this url ‘**http://127.0.0.1:8000/admin**’ and login as admin.
101
+- Once logged in, go to the bottom of the page and click on ‘Social applications’ and then click on ‘ADD SOCIAL APPLICATION’
102
+    - Provider: **Google**
103
+    - Name: **Google Login**
104
+    - Client id: **116415331974-tf6sehooctplmmn7j0gt831mdf1oqipl.apps.googleusercontent.com**
105
+    - Sites: double click on **localhost:8000**  
106
+    - Click save
107
+
108
+
109
+### Step 11: find id of site localhost:8000
110
+- Go to **server** directory in the terminal and type ‘**python manage.py shell**’
111
+- Inside the shell, run these commands:
112
+    - **from django.contrib.sites.models import Site**
113
+    - **Site.objects.all()**
114
+        - This will return a list of your sites [‘example.com’, ‘localhost:8000’]
115
+        - Step 3 will be the tricky part
116
+    - Run in your terminal: **Site.objects.get(id=1)**
117
+        - If you get an error you will need to run the same command above, but adding one to id. You will continue to do this until you get a return value of localhost:8000. Example: **Site.objects.get(id=2)**, **Site.objects.get(id=3)**, **Site.objects.get(id=4)**... My guess is that your value will be where id is between 4 and 7
118
+    - **Enter: ‘quit()’ in the shell**
119
+- Once you get your site id, go to **server/restful/settings.py**
120
+- In settings.py go to line 76 and change the value from **SITE_ID** to your value and save the file
121
+
122
+### Step 12: start with the frontend
123
+- Go to the **client** directory in the terminal and type **npm install** to install all the dependencies of the frontend application. It will ask you to install **expo-cli** and you will say yes. 
124
+
125
+### Step 13: run ngrok
126
+- Ngrok will act as our localhost and will allow us to connect the frontend with the backend
127
+- In your computer, go to where you installed ngrok. Click ‘ngrok.exe’. Inside the terminal of ngrok, type the following: ngrok http 8000 
128
+- This will return two urls in the forwarding columns. For example it will return something like the two urls below:
129
+    - **http://cc10e7b7abf5.ngrok.io**
130
+    - **https://cc10e7b7abf5.ngrok.io**
131
+**The two urls above won’t function. They are just examples**
132
+- Then, copy one of those urls, returned by ngrok (preferably the one with https)
133
+- Then, you will paste that url in various files inside the directory **client/Screens**
134
+- First let me give you an example
135
+    - You’ll see urls like these in the files: **http://7f9219a069f7.ngrok.io/api/add_taken_course** 
136
+    - In this case, you’ll need to replace **http://7f9219a069f7.ngrok.io** with the one above **http://cc10e7b7abf5.ngrok.io**
137
+    - The end result should like this **http://cc10e7b7abf5.ngrok.io/api/add_taken_course** instead of this **http://7f9219a069f7.ngrok.io/api/add_taken_course**
138
+- You’ll need to replace your ngrok url in the following files inside the directory **client/Screens**:
139
+    - **AddTakenCourse.js**: lines 55 and 95
140
+    - **Agenda.js**: line 33
141
+    - **CurrentCourses.js**: line 57 and line 89
142
+    - **EditGrades.js**: line 53, line 75 and line 120
143
+    - **EnrollNextSemester.js**: line 58 and line 96
144
+    - **HomeScreen.js**: line 15
145
+    - **Login.js**: line 46 and line 67
146
+    - **Logout.js**: line 13
147
+    - **MyCurriculum.js**: line 23 and line 46
148
+    - **UpdateSemYear.js**: line 24 and line 51
149
+**NOTE: EVERY TIME YOU WANT TO LOGIN THE USER, YOU’LL NEED TO RESTART NGROK AND REPLACE THE NEW URL OF NGROK IN EACH FILE. THE REASON FOR THIS IS BECAUSE WE’RE USING THE FREE VERSION OF NGROK.**
150
+
151
+
152
+### Step 14: run the app
153
+- Open a terminal and go to the **client** directory and in your terminal and type ‘**npm start**’. After running successfully go to this url **http://localhost:19002**
154
+- Open another terminal and go to the server directory and type ‘**python manage.py runserver**’
155
+- Use your phone to scan the qr code from expo and use CompanionApp
156
+
157
+
158
+# ADDITIONAL NOTES:
159
+- For now, the agenda works only through the dates **dec 14 - dec 19**. The agenda works around 80%. When you enroll in courses and go to your agenda, you will get an error. Just **ctrl + s** the file **Agenda.js** and see your agenda through the dates **dec 14 - dec 19**.
160
+- For now, the logout only works in the frontend. 
161
+**These issues will be solved in the future**
162
+
163
+# How to use CompanionApp
164
+- Everytime you complete an action on the screens **Add Taken Courses, Current Courses, Update Grades and Enroll Next Semester** wait for around 5 seconds to see a successful message
165
+- Screens where you can refresh the content by scrolling down are: **Current Courses, Agenda and  Update Grades**
166
+- On the screen **Add Taken Courses**: 
167
+    - Type in the search box a course that you already have taken. When typing in the search box you need to enter the code of the course. After you find the course, enter the grade and the semester and year you took the course. Click submit. 
168
+- On the screen **Agenda**: 
169
+    - In order to see your agenda you’ll need to enroll for courses next semester. After you enroll in courses for next semester, refresh the page by scrolling down. You will see a loader pop up and refresh the page. 
170
+- On the screen **Curren Courses**: 
171
+    - In order to see your current courses, you’ll need to add courses that you have already taken or enroll in courses for next semester. After you complete those things, scroll down to refresh the page and see your current courses.
172
+    - On this screen, you can click the course to see the information and you can also delete the course
173
+- On the screen **Update Grades**: 
174
+    - After you have registered for the app some courses, you will see a list of courses where you can filter by semester and year. Click on the course and update your grade or delete the course. On this screen you can also refresh the page by scrolling down.
175
+- On the screen **Enroll Next Semester**:
176
+    - Type in the search box for a course that you want to take for next semester. When typing in the search box, you need to enter the code of the course. You will get a list of courses. When you click on the course you want, you’ll see additional information about the course. If you want to enroll, click submit. 
177
+- On the screen **My Curriculum**: 
178
+    - This screen will show you a table of courses that you had taken by year and semester. You can filter those courses by year and semester. Also, you can see your GPA.
179
+- On the screen **Set your semester and year**: 
180
+    - you will report to the app what is your current semester and year. Pick the semester and year you are and it is mandatory that you click submit

+ 1
- 0
server/requirements.txt View File

@@ -3,3 +3,4 @@ djangorestframework==3.11.0
3 3
 django-allauth==0.42.0
4 4
 django-rest-auth == 0.9.5
5 5
 django-cors-headers==3.4.0
6
+psycopg2==2.8.6