Skip to content

Commit

Permalink
#241 Edit Facebook OAuth to README
Browse files Browse the repository at this point in the history
  • Loading branch information
viliambalaz committed May 26, 2020
1 parent 1e837af commit 3a2118d
Showing 1 changed file with 37 additions and 26 deletions.
63 changes: 37 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,40 @@ If some migrations fail, try to run them once or twice again. Sometimes it helps
4. Now, you can navigate your browser to: http://127.0.0.1:8000/ and start using it.


### 1.5. Viewing the site using https

To run a server with https you can use
[RunServerPlus](https://django-extensions.readthedocs.org/en/latest/runserver_plus.html) from
[django-extensions](https://github.com/django-extensions/django-extensions). You need the
`libffi-dev` package installed in your system.

1. Run the following commands:

$ env/bin/pip install django-extensions==1.0.3
$ env/bin/pip install Werkzeug==0.9
$ env/bin/pip install pyOpenSSL==0.13

2. Add `django_extension` to `INSTALLED_APPS` in `chcemvediet/settings/server_local.py` file:

INSTALLED_APPS = (
...
u'django_extensions',
...
)

3. Setup default protocol in `chcemvediet/settings/server_local.py`.

ACCOUNT_DEFAULT_HTTP_PROTOCOL = u'https'

4. Run the server in ssl mode with:

env/bin/python manage.py runserver_plus --cert /tmp/cert

5. Now, you can navigate your browser to: https://127.0.0.1:8000/ and start using it.

Or you can create a public https URL using [ngrok](https://ngrok.com/download).


## 2. Online Development and Production Servers

We run production server on Apache using `mod_wsgi` and MySQL database.
Expand Down Expand Up @@ -276,7 +310,7 @@ your browser.

### 3.2. Facebook OAuth

1. Go to https://developers.facebook.com/ and create an app.
1. Go to https://developers.facebook.com/apps/ and create an app.

2. Add a Product 'Facebook Login' and select platform 'Web'. Enter 'Site URL' `https://{domain}/`.

Expand All @@ -289,32 +323,9 @@ your browser.
Where `{domain}` is your production domain or `127.0.0.1:8000` if in local development mode.
'Site URL' in form `127.0.0.1:8000` is invalid use `localhost:8000` instead.

To use Facebook Login, you need to use https. Setup default protocol in `settings/common.py`.

ACCOUNT_DEFAULT_HTTP_PROTOCOL = u'https'

To run a server with https you can use
[RunServerPlus](https://django-extensions.readthedocs.org/en/latest/runserver_plus.html) from
[django-extensions](https://github.com/django-extensions/django-extensions). To install run:

$ pip install django-extensions==1.0.3
$ pip install Werkzeug==0.16.1
$ pip install pyOpenSSL==19.1.0

Add it to `INSTALLED_APPS` in `settings/common.py` file:

INSTALLED_APPS = (
...
'django_extensions',
...
)

Run the server in ssl mode with:

./manage.py runserver_plus --cert /tmp/cert
5. Run the configuration script `setup.py` and enter given 'App ID' and 'App Secret'.

Or you can create a public https URL using [ngrok](https://ngrok.com/). Don't forget to add newly
generated URL in 'Valid OAuth Redirect URIs'.
To use Facebook Login on localhost, you need to use [https connection](#15-viewing-the-site-using-https).


## 4. Google custom search engine key
Expand Down

0 comments on commit 3a2118d

Please sign in to comment.