Code Monkey home page Code Monkey logo

wearestudents's Introduction

Django is a powerful web framework that can help you get your Python application or website off the ground quickly. Django includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server is required.

In this guide, we will demonstrate how to install and configure Django in a Python virtual environment. We’ll then set up Apache in front of our application so that it can handle client requests directly before passing requests that require application logic to the Django app. We will do this using the mod_wsgi Apache module that can communicate with Django over the WSGI interface specification.

Ref:

https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04

Some useful command to make ready to deploy on server

sudo apt-get update

If you are using Django with Python 2, the commands you need are: sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3

If, instead, you are using Django with Python 3 sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3

We need to install the virtualenv command to create these environments. sudo pip install virtualenv

Run at root dir of project `virtualenv venv'

source myprojectenv/bin/activate pip install -r requirements.txt python manage.py makemigrations python manage.py migrate python manage.py createsuperuser python manage.py collectstatic python manage.py runserver 0.0.0.0:8000

In your web browser, visit your server’s domain name or IP address followed by :8000 http://server_domain_or_IP:8000

`Alias /static //resources/static <Directory //resources/static> Require all granted

<Directory //app> Require all granted

WSGIDaemonProcess wearestudents python-path=/ python-home=//venv WSGIProcessGroup wearestudents WSGIScriptAlias / //app/wsgi.py`

Permission

chmod 664 /<project-root-dir-path>/db.sqlite3 sudo chown :www-data /<project-root-dir-path>/db.sqlite3

sudo chown :www-data /<project-root-dir-path>

sudo service apache2 restart

Conclusion

In this guide, we’ve set up a Django project in its own virtual environment. We’ve configured Apache with mod_wsgi to handle client requests and interface with the Django app.

wearestudents's People

Contributors

ujshaikh avatar altamash2002 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.