Its super easy to set up our development environment
Install python-pip, python-dev and virtualenvwrapper
sudo apt-get install python-pip python-dev
sudo -H pip install virtualenvwrapperYou can clone it directly from https://github.com/amfoss/website
git clone https://github.com/amfoss/fosswebsite.gitFirst, some initialization steps. Most of this only needs to be done
one time. You will want to add the command to source
/usr/local/bin/virtualenvwrapper.sh to your shell startup file
(.bashrc or .zshrc) changing the path to virtualenvwrapper.sh
depending on where it was installed by pip.
export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.shLets create a virtual environment for our project
mkvirtualenv --python=`which python3` foss
workon fossAll the requirements are mentioned in the file requirements.txt.
Install mysql client.
In debian:
sudo apt install default-libmysqlclient-dev In ubuntu:
sudo apt install libmysqlclient-devFurther install all the requirement packages from the requirements.txt file.
pip install -r docs/requirements.txtThis project is deployed using a MySQL database,so it's recommended to set up a mysql server locally to ensure compatibility.
Install mysql-server
$ sudo apt install mysql-serverIf you are running Python3
$ pip3 install mysqlclientFor python2
$ pip install MySQL-pythonIf MySQL-python installation fails install 'default-libmysqlclient-dev' or 'libmysqlclient-dev' and try again.
$ sudo apt install default-libmysqlclient-devor
$ sudo apt install libmysqlclient-devLog into mysql as root
$ sudo mysql -u rootCreate a new user and database
create database fossamrita
mysql> CREATE USER 'foss'@'localhost' IDENTIFIED BY 'foss@amrita';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'foss'@'localhost'
-> WITH GRANT OPTION;where foss is the username and foss@amrita is the password.
logout using ctrl+d and login again using the new user
$ mysql -u foss -pCreate new database fossamrita, for avoiding this error: 'Specified key was too long; max key length is 767 bytes' in MariaDB just specify utf8_general_ci at creation time
mysql> create database fossamrita default CHARACTER set utf8 default COLLATE utf8_general_ci;$ cp fosswebsite/local_settings_sample.py fosswebsite/local_settings.pyThen migrate the db to complete the restore.
$ python manage.py migratepython manage.py createsuperuserpython manage.py runserver