Commit 1e3ef547 authored by apocalypse007's avatar apocalypse007

final commit

parents
cse-git link:
https://tarunsaurabh@git.cse.iitb.ac.in/tarunsaurabh/reinforcement-learning-peers-space.git
---------------------------------------------------------------------------------------------------------------
Abhijeet Pratap Singh 203059001 {Documentation and Data acquisition,templates}
Ayush Gupta 203050034 {Layout/ ML and RL related tasks/ Workingwith models}
Ankit Gaur 203050081 {Documentation and Data acquisition,templates}
Tarun Saurabh 203050009 {Python/ ML related tasks/models}
-----------------------------------------------------------------------------------------------------------------
Motivation:
Peer’s Space is started to provide a platform to exchangeknowledge between the experts of one field with the experts of other field. The vast majority of human knowledge is still not onthe internet. Most of it is trapped in the form of experience inpeople’s heads, or buried in books and papers that only expertscan access. As a consequence most people don’t have theknowledge they should, and don’t have the time, connections, orskills to get the knowledge faster.
In this project user can read and post article display of article on the feed is based on Thompson sampling from using beta distribution
------------------------------------------------------------------------------------------------------------------
How to use:
Using the peer's space is very simple. You need to have installed the dependencies.
To install python3 on ubuntu, run the following command in your terminal.
sudo apt-get install python3.6
pip3 install numpy
To install Django on ubuntu, run the following command in your terminal.
sudo apt-get install python3-django
One needs to git clone the project. After that open terminal in peers_space directory where manage.py is present and run following commands.
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver
To access the application open the web browser and go to "localhost:8000"
"""
ASGI config for ablog project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ablog.settings')
application = get_asgi_application()
"""
Django settings for ablog project.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'bdx=b5ko@sdfr!347*hhrn9v@l-7(n+a@k=yj$()zhd(5@&7kw'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'theblog',
'users',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'ablog.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'ablog.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
#{
# 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
#},
# {
# 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
# },
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = 'theblog/static/'
LOGIN_REDIRECT_URL = "home"
LOGOUT_REDIRECT_URL = "home"
"""ablog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path , include
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('theblog.urls')),
path('dashboard/',include('users.urls')),
]
"""
WSGI config for ablog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ablog.settings')
application = get_wsgi_application()
File added
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ablog.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
from django.contrib import admin
# Register your models here.
from .models import Post , Tags , alpha , total
admin.site.register(Post)
admin.site.register(Tags)
admin.site.register(alpha)
admin.site.register(total)
\ No newline at end of file
from django.apps import AppConfig
class TheblogConfig(AppConfig):
name = 'theblog'
# Generated by Django 3.1.2 on 2020-11-01 20:19
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('body', models.TextField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
# Generated by Django 3.1.2 on 2020-11-01 20:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('theblog', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='post',
name='tags',
field=models.CharField(max_length=255, null=True),
),
]
# Generated by Django 3.1.2 on 2020-11-15 10:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('theblog', '0002_post_tags'),
]
operations = [
migrations.CreateModel(
name='thompson',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ML', models.FloatField(default=0.0)),
('DIP', models.FloatField(default=0.0)),
('RL', models.FloatField(default=0.0)),
('SYSTEM', models.FloatField(default=0.0)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
# Generated by Django 3.1.2 on 2020-11-15 12:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('theblog', '0003_thompson'),
]
operations = [
migrations.CreateModel(
name='thompsonalpha',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ML', models.IntegerField(default=0)),
('DIP', models.IntegerField(default=0)),
('RL', models.IntegerField(default=0)),
('SYSTEM', models.IntegerField(default=0)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='thompsontotal',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ML', models.IntegerField(default=0)),
('DIP', models.IntegerField(default=0)),
('RL', models.IntegerField(default=0)),
('SYSTEM', models.IntegerField(default=0)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.DeleteModel(
name='thompson',
),
]
# Generated by Django 3.1.2 on 2020-11-15 15:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('theblog', '0004_auto_20201115_1214'),
]
operations = [
migrations.CreateModel(
name='Tags',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tag_name', models.CharField(max_length=255)),
],
),
migrations.AlterField(
model_name='post',
name='tags',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='theblog.tags'),
),
]
# Generated by Django 3.1.2 on 2020-11-15 15:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('theblog', '0005_auto_20201115_1514'),
]
operations = [
migrations.RenameField(
model_name='tags',
old_name='tag_name',
new_name='tagname',
),
]
# Generated by Django 3.1.2 on 2020-11-15 15:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('theblog', '0006_auto_20201115_1525'),
]
operations = [
migrations.RemoveField(
model_name='thompsontotal',
name='author',
),
migrations.AlterField(
model_name='post',
name='tags',
field=models.CharField(max_length=255),
),
migrations.DeleteModel(
name='thompsonalpha',
),
migrations.DeleteModel(
name='thompsontotal',
),
]
# Generated by Django 3.1.2 on 2020-11-15 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('theblog', '0007_auto_20201115_1553'),
]
operations = [
migrations.AddField(
model_name='post',
name='tagname',
field=models.CharField(default=0, max_length=255),
),
]
# Generated by Django 3.1.2 on 2020-11-15 16:30
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('theblog', '0008_post_tagname'),
]
operations = [
migrations.CreateModel(
name='total',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ML', models.IntegerField(default=0)),
('RL', models.IntegerField(default=0)),
('DIP', models.IntegerField(default=0)),
('MATHS', models.IntegerField(default=0)),
('userid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='alpha',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ML', models.IntegerField(default=0)),
('RL', models.IntegerField(default=0)),
('DIP', models.IntegerField(default=0)),
('MATHS', models.IntegerField(default=0)),
('userid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
# Generated by Django 3.1.2 on 2020-11-16 09:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('theblog', '0009_alpha_total'),
]
operations = [
migrations.AlterField(
model_name='post',
name='tags',
field=models.IntegerField(),
),
]
# Generated by Django 3.1.2 on 2020-11-16 19:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('theblog', '0010_auto_20201116_0959'),
]
operations = [
migrations.AddField(
model_name='alpha',
name='architecture',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='arts',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='chemistry',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='computer_science',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='engineering',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='geography',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='literature',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='physics',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='alpha',
name='python',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='architecture',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='arts',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='chemistry',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='computer_science',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='engineering',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='geography',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='literature',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='physics',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='total',
name='python',
field=models.IntegerField(default=0),
),
]