https://cmput404w19-web-project.herokuapp.com
Contributors:
Chengze Li ([email protected])
Frederic Sauve-Hoover ([email protected])
Xinrui Lu ([email protected])
Kehan Wang ([email protected])
Zhaozhen Liang ([email protected])
https://github.com/cmput404w19-project/group-project/wiki
Create a virtualenv and activate the python virtual environment
> virtualenv venv --python=python3
> source venv/bin/activate
Download the project and install all libraries that are needed
> git clone https://github.com/cmput404w19-project/group-project.git
> pip install -r requirments.txt
Migrate all the changes if there are any
and create superuser (this will be the admin on server)
and then we can run the server on localhost
> python manage.py migrate
> python manage.py createsuperuser
> python manage.py runserver
If you made any changes to the Django model, please run the follow to commiting all those changes to the actual SQL database
> python manage.py makemigrations
> python manage.py migrate
You will first need to get into the signup page and register an account. And then you will need to wait for one of the Admin to give you permission to log into the main home page. Or you can create a super user which will be the admin on the server as default. But other new sign up users will still need to grant permission to access the home page(login).
For accepting new sign up user's request for granting permission to access homepage(login), you must first have a super user account and then go to the admin page by "/admin" and then go to the User table and find the users you want to grant permission to and click into it and check the is_active
We decide to use lot of the AJAX on the client side for the purposes of sharing the server work load.
We have a heavy AJAX in our client side front end. We use for loop AJAX fetches and promise.all() to send all requests to all the servers(External endpoints and also our own server) APIs (/author/posts) for getting all the visible posts for that particular user
We send the comment post request to the server(the one which is hosting that post) API by fetch
For author profile, we pre-render the author url into the html before return to the client. And then the client side Javascript will send fetch request to the server that is hosting the author information (by that url)
We use fetch to send request to get the list of friends for that particular user in the friend page front end when user is viewing the friend list page
So the project theme is distributive social network, we follow the specification idea that each server is independent from each other and hosting only the posts information that is made by its own server user and also hosting each own server user's userprofile. Each server does not store any extra information about other server's user and posts except we store the url(api) that we can request for the data.
In this project, the definition of real friend is if two users are following each other. Our way of handling friend is to only keep one direction followship in each server. Each server will only store who their user is following but does not know who is following them since the other server will have that. In such way, handling friends across different servers are actually way easier. When validating friend lists we send request to other servers to verify if that user is also following him/her to get the two diretion followships.
For dealing with external endpoints, we use baisc auth which is provided by Django CRFS token for authentications to access APIs. And we have a model table to keep all the external servers information (hostname,username,password) that we are connecting to.
Answered by Pedro M Duarte:
https://stackoverflow.com/questions/2619102/djangos-self-client-login-does-not-work-in-unit-tests
https://docs.djangoproject.com/en/2.1/topics/testing/overview/
https://django-testing-docs.readthedocs.io/en/latest/index.html
author: Will Vincent
https://wsvincent.com/django-user-authentication-tutorial-login-and-logout/
https://wsvincent.com/django-user-authentication-tutorial-signup/
https://wsvincent.com/django-user-authentication-tutorial-password-reset/
Reference: Django model documentations https://docs.djangoproject.com/en/2.1/topics/db/models/
https://stackoverflow.com/questions/17710147/image-convert-to-base64
https://github.com/Hipo/drf-extra-fields#base64filefield
author: Vitor Freitas https://simpleisbetterthancomplex.com/tutorial/2016/07/28/how-to-create-django-signals.html
cutteeth https://stackoverflow.com/questions/40191931/django-how-to-use-request-post-in-a-delete-view
Django class-based view documentation:
https://docs.djangoproject.com/en/2.1/topics/class-based-views/
https://www.django-rest-framework.org/tutorial/3-class-based-views/
http://www.chenxm.cc/article/244.html
http://webdocs.cs.ualberta.ca/~hindle1/2014/07-REST.pdf
https://stackoverflow.com/questions/24971729/django-python-todataurl-return-a-response-with-the-string-from-todataurl
https://segmentfault.com/a/1190000010970988
Django decorator documentation:
https://docs.djangoproject.com/en/2.1/_modules/django/contrib/auth/decorators/
annoymous require:
author: yetty https://djangosnippets.org/users/yetty/
https://djangosnippets.org/snippets/2969/
https://fonts.google.com/?selection.family=Muli|Sniglet|Srisakdi
https://www.w3schools.com/css/css_inline-block.asp
https://www.w3schools.com/css/tryit.asp?filename=trycss_inline-block_span1
https://www.w3schools.com/cssref/pr_class_position.asp
https://www.w3schools.com/cssref/tryit.asp?filename=trycss_position_relative
https://www.w3schools.com/cssref/tryit.asp?filename=trycss_font-style
Author:Phrogz
https://stackoverflow.com/questions/5067279/how-to-align-this-span-to-the-right-of-the-div
https://stackoverflow.com/questions/21376788/how-to-display-3-buttons-on-the-same-line-in-css
https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_templates_social&stacked=h
https://www.zmrenwu.com/post/8/
Author:dusai
https://zhuanlan.zhihu.com/p/44939567
https://www.w3schools.com/bootstrap/bootstrap_button_groups.asp
Django Documentation
https://docs.djangoproject.com/zh-hans/2.1/
http://www.permadi.com/tutorial/jsInnerHTMLDOM/index.html
https://github.com/dispersal/CMPUT404-project-socialdistribution/blob/master/posts/static/author/author_posts.js
https://www.w3schools.com/jsref/event_onclick.asp
https://stackoverflow.com/questions/46630893/angular-res-json-is-not-a-function
https://developers.google.com/web/updates/2015/03/introduction-to-fetch
https://stackoverflow.com/questions/351409/how-to-append-something-to-an-array
https://docs.djangoproject.com/en/2.1/ref/csrf/
https://stackoverflow.com/questions/36131472/django-csrf-token-with-js
https://stackoverflow.com/questions/1795701/django-reverse-for-javascript
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
https://www.w3schools.com/jsref/prop_html_id.asp
https://stackoverflow.com/questions/36131472/django-csrf-token-with-js
https://www.jianshu.com/p/db2620e94a9b
https://stackoverflow.com/questions/11821261/how-to-get-all-selected-values-from-select-multiple-multiple
https://my.oschina.net/fengJeen/blog/1557344
https://ilusm.iteye.com/blog/232236
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
https://stackoverflow.com/questions/2941995/python-ignore-incorrect-padding-error-when-base64-decoding/49459036
https://github.com/showdownjs/showdown
https://github.com/showdownjs/showdown/wiki/Tutorial:-Markdown-editor-using-Showdown
https://github.com/showdownjs/showdown
https://github.com/showdownjs/showdown/wiki/Tutorial:-Markdown-editor-using-Showdown
https://www.jianshu.com/p/db2620e94a9b
Hidden Fields
https://ilusm.iteye.com/blog/232236
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
https://docs.djangoproject.com/en/2.1/howto/static-files/
https://stackoverflow.com/questions/5517950/django-media-url-and-media-root
https://www.itgank.com/archives/2557
https://stackoverflow.com/questions/604266/django-set-default-form-values
https://www.django-rest-framework.org/tutorial/3-class-based-views/
http://www.chenxm.cc/article/244.html
http://webdocs.cs.ualberta.ca/~hindle1/2014/07-REST.pdf
https://segmentfault.com/a/1190000010970988
Generally everything is LICENSE'D under the Apache 2 license by Frederic Sauve-Hoover, Kehan Wang, Chengze Li, Zhaozhen Liang, Xinrui Lu