Heroku Link: https://wall-e-chatbot.herokuapp.com/
cd ~/environment && git clone https://github.com/NJIT-CS490/project2-m1-zfh4.git && cd project2-m1-zfh4
- Install your stuff!
a)npm install
b)pip install flask-socketio
c)pip install eventlet
d)npm install -g webpack
e)npm install --save-dev webpack
f)npm install socket.io-client --save
g)sudo pip install requests
⚠️ ⚠️ ⚠️ If you see any error messages, make sure you usesudo pip
orsudo npm
. If it says "pip cannot be found", runwhich pip
and usesudo [path to pip from which pip] install
⚠️ ⚠️ ⚠️
- Update yum:
sudo yum update
, and enter yes to all prompts - Upgrade pip:
sudo /usr/local/bin/pip install --upgrade pip
- Get psycopg2:
sudo /usr/local/bin/pip install psycopg2-binary
- Get SQLAlchemy:
sudo /usr/local/bin/pip install Flask-SQLAlchemy==2.1
sudo service postgresql start
andcd ~/environment/lect12 && python
- In the python interactive shell, run:
import models
models.db.create_all()
models.db.session.commit()
- Install PostGreSQL:
sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
Enter yes to all prompts. - Initialize PSQL database:
sudo service postgresql initdb
- Start PSQL:
sudo service postgresql start
- Make a new superuser:
sudo -u postgres createuser --superuser $USER
⚠️ ⚠️ ⚠️ If you get an error saying "could not change directory", that's okay! It worked!⚠️ ⚠️ ⚠️ - Make a new database:
sudo -u postgres createdb $USER
⚠️ ⚠️ ⚠️ If you get an error saying "could not change directory", that's okay! It worked!⚠️ ⚠️ ⚠️ - Make sure your user shows up:
a)psql
b)\du
look for ec2-user as a user
c)\l
look for ec2-user as a database - Make a new user:
a)psql
(if you already quit out of psql) b) I recommend 4-5 characters - it doesn't have to be very secure. Remember this password!
create user [some_username_here] superuser password '[some_unique_new_password_here]';
c)\q
to quit out of sql cd
intolect11
and make a new file calledsql.env
and addSQL_USER=
andSQL_PASSWORD=
in it- Fill in those values with the values you put in 7. b)
There's a special file that you need to enable your db admin password to work for:
- Open the file in vim:
sudo vim /var/lib/pgsql9/data/pg_hba.conf
If that doesn't work:sudo vim $(psql -c "show hba_file;" | grep pg_hba.conf)
- Replace all values of
ident
withmd5
in Vim::%s/ident/md5/g
- After changing those lines, run
sudo service postgresql restart
- Ensure that
sql.env
has the username/password of the superuser you created! - Run your code!
a)npm run watch
. If prompted to install webpack-cli, type "yes"
b) In a new terminal,python app.py
c) Preview Running Application (might have to clear your cache by doing a hard refresh)
- Type in command
psql
- Type in
\c postgres
- Type in
delete from <databasename> (in our case usps);
- I came across a few problems when working on my code. I had a lot of problems that scaled from front-end to back-end. JSX is an environment that I am not too familiar with, so coding in it took a lot of Google searching. The biggest problems lay in the ambuigity and the specificness of certain features that I wanted to implement. For instance, when working on the front-end content JSX file, I encountered a lot of inconsistincies online as to how to format conditionals appropriately in returning rendered HTML in the script. I had to do a lot of trial and errors to finally figure out how to properly get a conditional line syntax to work. There were a few conditionals that I was having the most difficulty with and that was the ones where I was setting up conditionals for displaying bold font for my bot, or I was changing the profile image from my user to bot. The actual syntax I found to be confusing and took a lot of logical thinking on my part and online investigation.
- Another issue I came across was when deploying my app to Heroku, it would display an application error. In order to figure out why it was displaying, I had went to Professor Rengesh's office hours and discussed it with me. What I learned from his session, was that in the heroku app, there is a setting to check your logs. This is really convenient when you are trying to understand why the app is not being deployed properly. I realized that I did not have a particular module added in my requirements text and that was the primary reason why my heroku app wasn't being deployed.
- What I could've improved with this project would definitely be the user interface of both the google login page as well as the chat room. If I had more time I would've decorated the login to be a bit more visually appealing. For the chat room, I would've centered the chat box and made the button and input much bigger.
- Another issue I came across was that logged in users would've different users when independantly using the apps, but when together it would show the same person. This will be fixed with the next version of my application hopefully.