First go to the project directory , if you are on mac open terminal and then drug and drop your folder after writing cd to terminal like cd then drug and drop the folder and then press enter. Check current working directory by the following command “pwd”. After that create virtual environment for specific project and run following command
virtualenv env -p python2.7 source env/bin/activate
make sure to change python2.7 to your require version for the application. Like if you want to install it for python 3 environment then use
virtualenv env -p python3.1 source env/bin/activate
After running activate a specifiq environment created only fo4r this project , You can check by the following command
pip list
To disable virtual environment you can use the following command
deactivate
Make sure you are on project directory or it will not work. When you are working on several Django project then you have to activate / deactivate virtual environment based on running project.
After enabling virtual environment just check if there have any requirements file. Just run
pip install -r requirements.txt
As usual in every project there should be a file name requirements.txt which is actually requirement file for that specific application you are going to run.
Installing Django:
pip install Django
Starting Django project run the following command
django-admin.py startproject myproject
make sure to change myproject as per your project name always.
Separately to install django-cms run the following command
djangocms -s -p . your_project_name
Start Django CMS
python manage.py runserver
Run Server
python manage.py runserver 0.0.0.0:9002
this will run the django cms at 9002 port. So you can check it by http://localhost:9002
To create super user use the following command bellow
python manage.py createsuperuser
To migrate , run the following command
python manage.py migrate
After creating models or changing on models you must need to run migration or change will not be visible. If you make changes on static files like css or js then you have to run the following command to collect static
python manage.py collectstatic
Install Django e-Commerce by Oscar :
pip install django-oscar
All common error related fixing for Django projects
If mysql client error run the following command to install it
pip install mysqlclient
Windows Error :
Just go to settings.py and then change MIDDLEWARE to MIDDLEWARE_CLASSES