GithubHelp home page GithubHelp logo

yawan-1 / stackoverflow--clone Goto Github PK

View Code? Open in Web Editor NEW
311.0 6.0 63.0 17.12 MB

Fully Functional Stack Overflow Clone, with almost every functionality.

License: MIT License

Python 44.22% CSS 37.89% JavaScript 17.89% Procfile 0.01%
django stackoverflow python ajax django-project django-application jquery postgresql clone clone-app

stackoverflow--clone's Introduction

StackOver Flow - Clone

GitHub stars GitHub license GitHub commit activity python3.x

Clone of Stack Overflow where I implemented nearly all of its functionalities. My intention was to provide insight and demonstration to developers on the inner workings of Stack Overflow - including how tasks are performed behind the scenes and how queries are executed..

Images

Demo

Here is a working live demo : Demo (Removed from heroku because usage of so's production LOGO)

Technology Stack

Functionalities

  • 50+ Badges are implemented to award

  • 20 Privileges to Earn

  • Track Badges

  • Reputation Awarding

  • Privilege and Activity Notifications

  • Live Q&A MarkDown Preview

  • User @mentioning in comments

  • Create and award Bounties

  • Threading to keep track of the remaining days of Bounty.

  • Reviewing Tasks :

    • First Question Review
    • First Answer Review
    • Late Answer Review
    • Review Flag Posts
    • Review Flag Comments
    • Review Close Votes
    • Review ReOpen Votes
    • Review Low-Quality Posts
    • Review Suggested Edits
  • And much more. You can find list of all functionalities Here

Setup Commands

Clone this repository

  1. Clone this project using
$ git clone https://github.com/Yawan-1/StackOverFlow--Clone

For Postgresql usage*, you will need to download and install it.

  1. Download Postgresql from this Link
  2. After installation, create Database in postgresql shell using these commands
    1. CREATE DATABASE so_clone;
    2. CREATE USER so_clone_user WITH PASSWORD 'password';
    3. GRANT ALL PRIVILEGES ON DATABASE so_clone TO so_clone_user;
  3. and fill database name , database password and user in settings.py like
DATABASES = {
  'default': {
      'ENGINE': 'django.db.backends.postgresql_psycopg2',
      'NAME': 'so_clone',
      'USER': 'so_clone_user',
      'PASSWORD': 'password',
      'HOST': 'localhost',
      'PORT': '',
  }
}

*Note: If you are setting up this project using sqlite, you have the option to bypass the postgresql installation step. To do so, please consider commenting out the postgresql configuration and uncommenting the sqlite configuration.

Now run make migrations command, running make migrations command will perform Data Migrations to save the "Badges" in the database. then migrate to load the operations of Data Migrations in database.

$ python manage.py makemigrations
$ python manage.py migrate

Migration Operations will be automatically created on migration creation to save Tags and Tag Badges.

Then, simply run the server using this command.

$ python manage.py runserver

Deployment

The following details and steps on how to deploy this application

Heroku

See detailed Deploying django app on Heroku

Contributing

If you have any question or issues, It may have bugs that i may have missed. You can create Pull request.

Note: Frontend and complete design is also inside this project's repo (html, css).

stackoverflow--clone's People

Contributors

dependabot[bot] avatar rabbani2101 avatar yawan-1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stackoverflow--clone's Issues

it does not update the users

I'm testing it locally and with sqlite and it doesn't let me update the users and it doesn't let me mark the correct answer and vote for the answers

ValueError: Missing staticfiles manifest entry for 'plugins/css/bootstrap.min.css'

image
uring handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/admin/anaconda3/lib/python3.6/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
    response = self.get_response(request)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 130, in get_response
    response = self._middleware_chain(request)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 49, in inner
    response = response_for_exception(request, exc)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 114, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/Users/admin/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 153, in handle_uncaught_exception
    return callback(request)
  File "/Users/admin/StackOverFlow--Clone/qa/views.py", line 64, in handler500
    return render(request, 'home/500.html')
  File "/Users/admin/.local/lib/python3.6/site-packages/django/shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/templatetags/static.py", line 106, in render
    url = self.url(context)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/templatetags/static.py", line 103, in url
    return self.handle_simple(path)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/templatetags/static.py", line 118, in handle_simple
    return staticfiles_storage.url(path)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 147, in url
    return self._url(self.stored_name, name, force)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 126, in _url
    hashed_name = hashed_name_func(*args)
  File "/Users/admin/.local/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 417, in stored_name
    raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
ValueError: Missing staticfiles manifest entry for 'plugins/css/bootstrap.min.css'
[13/Jan/2022 15:59:35] "GET /favicon.ico HTTP/1.1" 500 59

Use Stacks for front-end

This is amazing! You should consider using Stack Overflow's design system Stacks to power the front-end. This way, you can pin to a specific version of Stacks without hotlinking to Stack Overflow's production CSS. That'll guard your project from us breaking your CSS inadvertently.

$ python manage.py makemigrations issue

python manage.py migrate
File "D:\Projects\stackoverflow\StackOverFlow--Clone-master-Yawan-1\tagbadge\models.py", line 3, in
from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation'

No way for a user to up/down vote on questions and answers

It seems that there is no way for a user to up/down vote on questions and answers as the rewardPrivielege() cannot be called in any path to update user's comment_everywhere_Priv, voteDownPriv and voteUpPriv for a new user,even though that the user may have enough reputation.

Problem with static files

Hello. I have problem with static files like this:
image
image
and other stuff. But admin console works perfectly with css:
image

Idk why, but nginx works right with admin console, there is it logs:
image

Site logs:

image

Nginx config:


upstream main {
    server web:8000;
}

server {

    listen 80;
    location / {
        proxy_pass http://main;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
        client_max_body_size 100M;
    } 
    location /static/ {
        alias /home/app/web/staticfiles/;
    }
}

Docker-compose


version: '3.8'

services:
  web:
    build: .
    #command: /bin/sh -c "python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic --no-input && gunicorn main.wsgi:application --bind 0.0.0.0:8000"
    command: /bin/sh -c "gunicorn main.wsgi:application --bind 0.0.0.0:8000"
    volumes:
      - ./staticfiles/:/usr/src/app/staticfiles/
    expose:
      - 8000
    ports:
      - 8000:8000
    depends_on:
      - db
  db:
    image: postgres:14.0
    volumes:
      - ./postgres_data/:/var/lib/postgresql/data/
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=database
    ports:
      - 5432:5432
  nginx:
    build: ./nginx
    ports:
      - 80:80
    volumes:
      - ./staticfiles/:/home/app/web/staticfiles/
    depends_on:
      - web

does not vote

does not allow up or down votes.

At first it wouldn't let me select the correct answer due to a design error that forces you to vote for the answer you are selecting as correct.

I altered the code a bit to allow me to select the correct answer and raise reputation and get to select 2 correct answers raising to 30 reputation without voting for the correct answer.

At the time of voting it keeps throwing me the error having the user 30 of reputation.

Captura de pantalla (13)

error that appears in the local server

`Cannot Make another Edit
Printing the Last Edit Vote Status

[18/Apr/2022 14:22:25] "GET /questionDetailView/1/ HTTP/1.1" 200 188151
[18/Apr/2022 14:22:26] "POST /martor/markdownify/ HTTP/1.1" 200 0
[18/Apr/2022 14:22:30] "GET /answer_upvote_downvote/1/?submit=like HTTP/1.1" 200 29`

Search is NOT shown when runs it locally.

image

Here is the header displayed while I ran this project on my local machine, as you can see that the search bar is missing and the header is NOT well lay out. Could you please help take a look?

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.