Django package to sync and display personal Instagram media
Project description
django-instagram-profile
A Django application that allows to fetch individual Instagram user profile media data and save into database. Instagram media is managed using Django admin console. Demo
Instagram profile
First you need to configure Instagram application following these instructions: Instagram Basic Display API
Requirements
Installation
Install Django and other required packages. It is very handy to use pipenv for this.
pipenv install django requests pillow configparser
By default, newly created Django project configuration uses SQLite. If you're using other database engine make sure you configure it properly beforehand.
Install Instagram profile package:
pipenv install django-instagram-profile
Create env.ini file inside your project directory with the following settings:
[instagram]
account = instagram_account_name
auth_url = https://api.instagram.com/oauth/authorize
access_token_url = https://api.instagram.com/oauth/access_token
app_id = 123
secret = abc
redirect_url = https://mysite.com/admin/instagram_profile/post/sync
media_url = https://graph.instagram.com
Configuration
Add the application to INSTALLED_APPS:
INSTALLED_APPS = ('instagram_profile',)
Create a folder for Instagram media
/project_name/media/instagram
Configure correct paths for uploaded instagram media in settings.py
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
MEDIA_URL = '/media/'
Add media template context processor in the settings.py Also add template dir to the list of dirs
TEMPLATES = [
{
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'OPTIONS': {
'context_processors': [
'django.template.context_processors.media', # add this line
],
},
},
]
Add url to display instagram media feed in urls.py
urlpatterns = [
path('instagram/', include('instagram_profile.urls')), # add this line
]
To serve media files during development need to add following lines to urls.py
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Run the database migrations
python manage.py migrate
Releases
- 0.1.0 Alpha version
- 0.1.1 Handling invalid auth code exception
- 0.1.2 Use text field for instagram captions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-instagram-profile-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27b6db454d1bdcacea79e56cdd60a78d68eaa9c959eb53b9cfcd7798b3eb4cf4 |
|
MD5 | 5a41c534d93fb0d2ba5e3d6a86cf272d |
|
BLAKE2b-256 | 930fa2da62577d42ca0ab0a94485b839e6fc201d916df7603f95e2ca820ae920 |
Hashes for django_instagram_profile-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2138ce859b7b662c9c2459002bee431c18ed95aa3776b34393fb29deee4d4925 |
|
MD5 | 78815ceee0e25f7c5a5b278ab3b1cb97 |
|
BLAKE2b-256 | e8b005c717d0e0a39f05895a63b48428ee806432a43da04bec678a62cf397920 |