This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added setup information, API documentation
- Loading branch information
Showing
13 changed files
with
165 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,3 @@ | ||
# Youniversity | ||
|
||
[![Docs](https://readthedocs.org/projects/social/badge/?version=latest)](https://social.readthedocs.org) | ||
|
||
## Setup | ||
|
||
1. Setup virtual environment: `virtualenv venv; source venv/bin/activate` | ||
2. Setup requirements: `pip install -r requirements.txt` | ||
3. Sync database: `python manage.py migrate` | ||
4. Add user: `python manage.py createsuperuser` | ||
5. Run webserver: `python manage.py runserver` | ||
6. Visit the admin page at `http://localhost:8000/admin/` | ||
7. Fix the first site name from example.com to localhost:8000 | ||
8. Add a new social app, using your Facebook app ID and secret | ||
|
||
## Development | ||
|
||
- Run webserver: `python manage.py runserver` | ||
- Enter the front page at http://localhost:8000/static/index.html | ||
[![Docs](https://readthedocs.org/projects/social/badge/?version=latest)](https://social.readthedocs.org) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
User package | ||
============ | ||
|
||
.. automodule:: User | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Submodules | ||
---------- | ||
|
||
User.models module | ||
------------------ | ||
|
||
.. automodule:: User.models | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
User.views module | ||
----------------- | ||
|
||
.. automodule:: User.views | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
auth | ||
================= | ||
|
||
This endpoint is handled by :py:mod:`authapi.views` | ||
|
||
.. http:get:: /api/auth/check | ||
:synopsis: Validate current user session | ||
|
||
This API is used to check whether the current user is logged in | ||
and to retrieve information about the user. | ||
|
||
This endpoint is handled by :py:func:`authapi.views.UserViewSet.get` | ||
|
||
**Example request**: | ||
|
||
.. sourcecode:: http | ||
|
||
GET /api/auth/check HTTP/1.1 | ||
Host: social.whs.in.th | ||
Accept: application/json, text/javascript | ||
Cookie: sessionid=..... | ||
|
||
**Example response when logged in**: | ||
|
||
.. sourcecode:: http | ||
|
||
HTTP/1.1 200 OK | ||
Content-Type: application/json | ||
X-Frame-Options: SAMEORIGIN | ||
Allow: GET, HEAD, OPTIONS | ||
|
||
"whs" | ||
|
||
**Example response when not logged in**: | ||
|
||
.. sourcecode:: http | ||
|
||
HTTP/1.1 403 FORBIDDEN | ||
Content-Type: application/json | ||
X-Frame-Options: SAMEORIGIN | ||
Allow: GET, HEAD, OPTIONS | ||
|
||
"" | ||
|
||
:statuscode 403: User is not logged in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
API Documentation | ||
======================== | ||
|
||
The API root is at ``/api`` | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Modules Index | ||
============= | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
User | ||
authapi | ||
newsfeed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from sphinx.domains.std import StandardDomain | ||
|
||
|
||
def setup(app): | ||
StandardDomain.initial_data['labels']['routingtable'] = ( | ||
'http-routingtable', | ||
'', | ||
'HTTP Routing Table') | ||
StandardDomain.initial_data['anonlabels']['routingtable'] = ( | ||
'http-routingtable', | ||
'') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Getting started | ||
==================== | ||
|
||
1. Setup virtual environment:: | ||
virtualenv venv | ||
source venv/bin/activate | ||
|
||
2. Setup requirements:: | ||
|
||
pip install -r requirements.txt | ||
|
||
3. Sync database:: | ||
|
||
python manage.py migrate | ||
|
||
4. Add user:: | ||
python manage.py createsuperuser | ||
|
||
5. Run webserver:: | ||
|
||
python manage.py runserver | ||
|
||
Starting the web server | ||
------------------------- | ||
|
||
1. Run webserver:: | ||
|
||
python manage.py runserver | ||
|
||
2. Enter the front page at `http://localhost:8000/static/index.html <http://localhost:8000/static/index.html>`_ | ||
|
||
|
||
Configure Facebook login | ||
----------------------------- | ||
|
||
1. Enter Django administration page at `http://localhost:8000/admin/ <http://localhost:8000/admin/>`_ | ||
2. Click *Sites* then fix the first site name from ``example.com`` to ``localhost:8000`` | ||
3. Go back to front page and click *Social applications* | ||
4. Add new social application. Enter the following information: | ||
|
||
* Name: Facebook | ||
* Client ID, Secret Key: As given by Facebook (`Register a new Facebook application <https://developers.facebook.com/apps/>`_) | ||
* Sites: Add ``localhost:8000`` to the list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
cd `dirname $0`/.. | ||
sphinx-apidoc -f -M -H Youniversity -o docs . \ | ||
*/urls.py */migrations manage.py social ui | ||
mv docs/modules.rst docs/index.rst | ||
sphinx-apidoc -f -M -H "Modules Index" -o docs . \ | ||
*/urls.py */migrations */tests* */admin* \ | ||
manage.py social ui docs | ||
sphinx-build -b html docs docs/_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters