Commit 66deec82 authored by Andreas Burbach's avatar Andreas Burbach
Browse files

change folder names

parent add9823b
......@@ -24,8 +24,8 @@ yarn-error.log*
*.eslintcache
*/media/account/images/
the_social_network/django_static
social_network/django_static
pypi/*/
the_social_network/dist
the_social_network/the_social_network.egg-info
\ No newline at end of file
social_network/dist
social_network/the_social_network.egg-info
\ No newline at end of file
......@@ -33,7 +33,7 @@ test:
script:
- echo "Testing ..."
- docker-compose -f docker-compose.ci.yml pull
- docker-compose -f docker-compose.ci.yml run web sh -c "poetry run python manage.py makemigrations && poetry run python manage.py migrate && poetry run python manage.py test core -v 2"
- docker-compose -f docker-compose.ci.yml run web sh -c "poetry run python manage.py makemigrations && poetry run python manage.py migrate && poetry run python manage.py test the_social_network -v 2"
deploy:
only:
......@@ -43,9 +43,7 @@ deploy:
- test
script:
- echo "Deploying ..."
- cd ./the_social_network
- mv ./the_social_network ./not_needed
- mv ./core ./the_social_network
- cd ./social_network
- apk add py-pip
- pip install poetry
- poetry --version
......
# The Social Network
`the_social_network/` is the backend of the most thinkable fronted for social networks, which was developed with [Django](https://www.djangoproject.com/) and [Django Rest Framework](https://www.django-rest-framework.org/)
`social_network/` is the backend of the most thinkable fronted for social networks, which was developed with [Django](https://www.djangoproject.com/) and [Django Rest Framework](https://www.django-rest-framework.org/)
This subproject is the basis for any possible type of social networks.
The `core/` subfolder is the core of this project an is managed to working as a starting point for any further works on basic social networks.
The `the_social_network/` subfolder is the core of this project an is managed to working as a starting point for any further works on basic social networks.
Use the [Postman-Documentation](https://documenter.getpostman.com/view/13331140/TzRNFVaC) and run it locally for a detailed overview about the API.
Make sure the database is seeded with corresponding data.
......
......@@ -6,7 +6,7 @@ import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'the_social_network.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'social_network.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
......
[build-system]
requires = [ "poetry-core>=1.0.0", "poetry-dynamic-versioning",]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "the-social-network"
version = "0.0.1"
version = "0.0.0"
description = "Basic social network core."
authors = ["Marc Feger <marc.feger@hhu.de>"]
authors = [ "Marc Feger <marc.feger@hhu.de>",]
license = "BSD-4"
readme = "README.md"
exclude = ["not_needed"]
homepage = "https://gitlab.cs.uni-duesseldorf.de/feger/the-social-network"
[tool.poetry-dynamic-versioning]
enable = true
[tool.poetry.dependencies]
python = "^3.9"
......@@ -16,10 +21,4 @@ djangorestframework = "^3.12.4"
Pillow = "^8.4.0"
django-cors-headers = "^3.10.0"
django-dotenv = "^1.4.2"
uWSGI = "^2.0.20"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
uWSGI = "^2.0.20"
\ No newline at end of file
"""
ASGI config for the_social_network project.
ASGI config for social_network project.
It exposes the ASGI callable as a module-level variable named ``application``.
......@@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'the_social_network.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'social_network.settings')
application = get_asgi_application()
"""
Django settings for the_social_network project.
Django settings for social_network project.
Generated by 'django-admin startproject' using Django 3.1.2.
......@@ -42,7 +42,7 @@ INSTALLED_APPS = [
'corsheaders',
'rest_framework',
'rest_framework.authtoken',
'core',
'the_social_network',
]
MIDDLEWARE = [
......@@ -56,7 +56,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'the_social_network.urls'
ROOT_URLCONF = 'social_network.urls'
TEMPLATES = [
{
......@@ -74,7 +74,7 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = 'the_social_network.wsgi.application'
WSGI_APPLICATION = 'social_network.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
......
"""the_social_network URL Configuration
"""social_network URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
......@@ -21,8 +21,8 @@ from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^authentication/', include('core.urls.authenticationUrls')),
url(r'^accounts/', include('core.urls.accountUrls')),
url(r'^search/', include('core.urls.searchUrls')),
url(r'^contents/', include('core.urls.contentUrls')),
url(r'^authentication/', include('the_social_network.urls.authenticationUrls')),
url(r'^accounts/', include('the_social_network.urls.accountUrls')),
url(r'^search/', include('the_social_network.urls.searchUrls')),
url(r'^contents/', include('the_social_network.urls.contentUrls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
WSGI config for the_social_network project.
WSGI config for social_network project.
It exposes the WSGI callable as a module-level variable named ``application``.
......@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'the_social_network.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'social_network.settings')
application = get_wsgi_application()
......@@ -2,4 +2,4 @@ from django.apps import AppConfig
class AuthenticationConfig(AppConfig):
name = 'core'
name = 'the_social_network'
......@@ -26,8 +26,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('from_account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='from_account', to='core.account')),
('to_account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_account', to='core.account')),
('from_account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='from_account', to='the_social_network.account')),
('to_account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_account', to='the_social_network.account')),
],
options={
'ordering': ('-created',),
......@@ -36,7 +36,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='account',
name='related_to',
field=models.ManyToManyField(blank=True, default=None, related_name='related_by', through='core.Relationship', to='core.Account'),
field=models.ManyToManyField(blank=True, default=None, related_name='related_by', through='the_social_network.Relationship', to='the_social_network.Account'),
),
migrations.CreateModel(
name='Statement',
......@@ -44,7 +44,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.CharField(max_length=120)),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.account')),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='the_social_network.account')),
],
options={
'ordering': ('-created',),
......@@ -63,8 +63,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('hashtag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hashtag', to='core.hashtag')),
('statement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.statement')),
('hashtag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hashtag', to='the_social_network.hashtag')),
('statement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='the_social_network.statement')),
],
options={
'ordering': ('-created',),
......@@ -73,15 +73,15 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='statement',
name='tagged',
field=models.ManyToManyField(blank=True, default=None, related_name='tags', through='core.HashtagTagging', to='core.Hashtag'),
field=models.ManyToManyField(blank=True, default=None, related_name='tags', through='the_social_network.HashtagTagging', to='the_social_network.Hashtag'),
),
migrations.CreateModel(
name='AccountTagging',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='account', to='core.account')),
('statement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.statement')),
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='account', to='the_social_network.account')),
('statement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='the_social_network.statement')),
],
options={
'ordering': ('-created',),
......@@ -90,7 +90,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='statement',
name='mentioned',
field=models.ManyToManyField(blank=True, default=None, related_name='mentions', through='core.AccountTagging', to='core.Account'),
field=models.ManyToManyField(blank=True, default=None, related_name='mentions', through='the_social_network.AccountTagging', to='the_social_network.Account'),
),
migrations.CreateModel(
name='Reaction',
......@@ -98,8 +98,8 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('vote', models.PositiveSmallIntegerField(choices=[(1, 'like'), (2, 'dislike')], default=1)),
('child', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='child', to='core.statement')),
('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parent', to='core.statement')),
('child', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='child', to='the_social_network.statement')),
('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parent', to='the_social_network.statement')),
],
options={
'ordering': ('-created',),
......@@ -108,6 +108,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='statement',
name='reactions',
field=models.ManyToManyField(blank=True, default=None, related_name='reaction_of', through='core.Reaction', to='core.Statement'),
field=models.ManyToManyField(blank=True, default=None, related_name='reaction_of', through='the_social_network.Reaction', to='the_social_network.Statement'),
),
]
......@@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
('the_social_network', '0001_initial'),
]
operations = [
......
......@@ -14,7 +14,7 @@ class Statement(models.Model):
"""
This model represents an statement of an specific account.
"""
author = models.ForeignKey('core.Account', on_delete=models.CASCADE)
author = models.ForeignKey('the_social_network.Account', on_delete=models.CASCADE)
content = models.CharField(max_length=120, blank=False)
created = models.DateTimeField(auto_now_add=True, db_index=True)
# Add an hashtag between statements and hashtags over the tagging model
......@@ -24,7 +24,7 @@ class Statement(models.Model):
symmetrical=False,
related_name='tags',
default=None)
mentioned = models.ManyToManyField('core.Account',
mentioned = models.ManyToManyField('the_social_network.Account',
blank=True,
through='AccountTagging',
symmetrical=False,
......@@ -62,7 +62,7 @@ class Statement(models.Model):
used_mentions: List[str] = self.__extract_mentioning()
# resolve mentions after saving the statement
for used_mention in used_mentions:
account: 'core.Account' = apps.get_model("core", "Account").objects.filter(
account: 'the_social_network.Account' = apps.get_model("the_social_network", "Account").objects.filter(
user__username=used_mention).first()
if account:
self.add_mentioning(account=account)
......@@ -156,7 +156,7 @@ class Statement(models.Model):
).delete()
return deleted
def __extract_mentioning(self) -> List['core.Account']:
def __extract_mentioning(self) -> List['the_social_network.Account']:
"""
This method extracts the mentions of accounts in the calling statement.
Accounts names are alpha numeric words.
......@@ -165,7 +165,7 @@ class Statement(models.Model):
"""
return re.findall(r"@(\w+)", self.content)
def add_mentioning(self, account: 'core.Account'):
def add_mentioning(self, account: 'the_social_network.Account'):
"""
This method is for adding an mention of an account to the corresponding statement.
:param account: The account to be mentioned.
......@@ -174,7 +174,7 @@ class Statement(models.Model):
mentioning, created = AccountTagging.objects.get_or_create(statement=self, account=account)
return created
def get_mentioning(self) -> List['core.Account']:
def get_mentioning(self) -> List['the_social_network.Account']:
"""
This method is to get all accounts mentioned by the calling statement.
......@@ -182,7 +182,7 @@ class Statement(models.Model):
"""
return list(self.mentioned.all())
def remove_mentioning(self, account: 'core.Account'):
def remove_mentioning(self, account: 'the_social_network.Account'):
"""
This method is used to delete an specific mentioning of an account for the calling statement.
......@@ -244,7 +244,7 @@ class AccountTagging(Tagging):
This model is to represent the mention of an account within an statement.
"""
# Which account should be mentioned?
account = models.ForeignKey('core.Account', related_name='account', on_delete=models.CASCADE)
account = models.ForeignKey('the_social_network.Account', related_name='account', on_delete=models.CASCADE)
class Meta:
ordering = ('-created',)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment