Auto-Scheduler
Install
Follow these steps to start a local Django server using a PostgreSQL database:
- If you don’t have it already, download Python from here.
- To install the packages, you first need to make a virtual environment for Python, which will help us ensure that our libraries & Python versions are unified. You can do so be by running:
python3 -m venv env
- This creates a virtual environment in the
env/
folder. - In here you'll see a directory containing the libraries that will be installed in the next step(
Lib/
on Windows) - You'll also see a folder(
Scripts/
on Windows &bin/
on Unix systems) that contains the scripts that you need to start the virtual environment.
- This creates a virtual environment in the
- Next, for Unix systems run:
source env/bin/activate
- And for Windows, in Powershell run:
./env/Scripts/activate
- If you get a permissions error that says:
execution of scripts is disabled on this system
, then open another PowerShell as Administrator and runSet-ExecutionPolicy -ExecutionPolicy RemoteSigned
.- Alternatively, you can just run the original script as Administrator.
- If you get a permissions error that says:
- You will need to do
source env/bin/activate
or./env/Scripts/activate
anytime you want to interact with the server(i.e. to run it withpython manage.py runserver
)
- Now, run
pip install -r requirements.txt
to install the necessary packages for the project.- For MacOS: If your installation fails for
psycopg2
run:brew reinstall openssl
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
- For MacOS: If your installation fails for
- Set up a PostgresQL server by following one of these guides, and make sure you set the name of the database when prompted to
dbautoscheduler
:
Windows/Mac
Linux
You may also want to download pgAdmin 4 for ease of database management (it can be installed with PostgreSQL if you used the about Windows/Mac guide). It can also be downloaded from here. - (Only if using pgAdmin) Create a new server by opening pgAdmin and right-click “Servers->Create->Server…”. Set a name pgAdmin will use (it can be anything), then change to the Connection tab. Ensure the following settings are being used:
Host name/address: localhost
Port: 5432
Maintenance database: postgres
Username: postgres
Password: (not necessary) - Ensure the database
dbautoscheduler
has been created:
Using psql: Type\l
in the psql prompt and see ifdbautoscheduler
is in the list.
Using pgAdmin: Click the name of the server you created, and see ifdbautoscheduler
is in the tree menu. - If you'd like to get the current project running, you can clone the repository with
git clone https://github.com/gannonprudhomme/AutoScheduler/
and run the steps below.
Running
The only thing set up currently is scraping a single department worth of courses(CSCE) and scraping all of the departments.
To do these,
- If you're not running in the virtual environment(you should see
(env)
somewhere in your current terminal line), runsource env/bin/activate
or./env/Scripts/activate
- Run
cd autoscheduler
- Run
./manage.py makemigrations
and./manage.py migrate
to generate SQL that will be used to fill the database. - Run
./manage.py createsuperuser
to create a user for Django. - Run
./manage.py scrape_dept
to scrape all of the available departments. - Run
./manage.py scrape_courses
to scrape the courses, sections, and instructors.
If ./manage.py
isn't working, try to use python manage.py
or python3 manage.py
in place of it.