Git Product home page Git Product logo

socketio's Introduction

Chat Application

This project is a chat application based on the following tech stack1:

  • Docker
  • Django 3
    • asgi2
    • python-socketio
    • djoser
  • React
  • Socket.IO

Start the project

  • Install Docker
  • Clone the repo
  • Add .env in ./django with content
    POSTGRES_DB=postgres
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=postgres
    POSTGRES_HOST=postgres
    POSTGRES_SSL_MODE=off
    SECRET_KEY=q$w!oi*7)x$=c#s(9+h@2prnbas$rsy-eh(#xm5fkd(vq3%^7o
    
    EMAIL_HOST={your-email-host}
    EMAIL_HOST_USER={your-email-host-user}
    EMAIL_HOST_PASSWORD={your-email-host-password}
    
    DOMAIN=localhost:3000
    SITE_NAME=socketio
    
  • Add .env in ./postgres with content
    POSTGRES_DB=postgres
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=postgres
    POSTGRES_HOST=postgres
    POSTGRES_SSL_MODE=off
    
  • Add folders ./django/storage/static and ./django/storage/media that will contain Django's static & media files
  • Open terminal at root level of the repo, and run
    (root) ➜ docker-compose up
    
  • Open the browser at http://localhost:8000/

Fabric3

An additional fabfile.py module has been added to allow certain operations with Docker containers (e.g., ssh inside a container). To use it, you need to:

  • Install Fabric3
  • Open terminal at root level of the repo, and run one of the commands defined in the fabfile.py module, e.g., you can ssh inside the django container by simply running:
    (root) ➜ fab ssh:django
    

Windows Issues

When running on Windows, be sure to setup Docker to run in Linux mode. Moreover, it can happens that git automatically restyled the EOL (End Of Line) of bash files. To avoid this problem, run this global command

git config --global core.autocrlf input

This command avoids the EOL (End Of Line) replacement. The latter is due to git which automatically reformat the file based on the current OS. As a conseguence, Linux-style EOL are replaced with Windows-style EOL.

TODO

Serve the client from a React application

1: The example is inspired by this repo.

2: An analogous example in which wsgi is used instead of asgi is given here.

socketio's People

Watchers

 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.