New Project - django_steemconnect , How to configure and use it with your django application.steemCreated with Sketch.

in utopian-io •  last year  (edited)

Repository

https://github.com/coogger/django_steemconnect

New Projects

In the past months, I made a new project for steemconnect python client named steemconnect2py short name sc2py.
Check address below to projects details.

now I decided to make Django application using this library, With this application, you can easily log in, register, and log out with your Django application using SteemConnect.

Technology Stack

  • Django 2
  • sc2py

Roadmap

The project is over and ready for use.

How to contribute?

  • If you find a bug, you can send pull requests or contact me.
  • If you think any feature is missing in the project, you can add it or communicate with me.

GitHub Account

https://github.com/hakancelik96

How to use this project in my project ?

Firstly, we need to set up the libraries that in requirements files.

pip install django
pip install sc2py

after we need to set up this project.

pip install django_steemconnect

open a new steem application in this address, https://v2.steemconnect.com/apps/me like this


1.JPG

Set up your Django project and open your project's settings.py file, you must set the following codes by your project, django_steemconnect uses these settings.

##steemconnect settings
REDIRECT_URL = "http://www.coogger.com/accounts/steemconnect/"
CLIENT_ID = "coogger.app"
APP_SECRET = "your app secret"
SCOPE = None 
# default scopes ="login,offline,vote,comment,delete_comment,comment_options,custom_json,claim_reward_balance"
CODE = True 
LOGIN_REDIRECT = "/web/feed/"
##steemconnect settings

You should type REDIRECT_URL as in the photo below.

1.JPG

LOGIN_REDIRECT, after the user logged in, you should write it to which page you want to redirect it to.

access_token has a limited lifetime, thus if you need to refresh them in your own without authenticating the user again, you can set CODE = True.

then, add the django_steemconnect to the list of applications.

INSTALLED_APPS = [
    "myapp",
    "django_steemconnect",
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',"
]

and finally, add the django_steemconnect URLs to the list of your project URLs.

# /urls.py
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
import django_steemconnect

urlpatterns = [
    url(r"^",include("myapp.urls")), 
    url(r"^accounts/", include('django_steemconnect.urls')), # signup, login or create new user
    url(r'^web/admin/', admin.site.urls), # admin panel
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)

Let's place URLs in a template

for logout operation
{% url 'logout' %}
for login operation
{% url 'login' %}

After all these operations, we must do them for the database settings.

python manage.py makemigrations
python manage.py migrate

Let's look at the admin panel.

1.JPG


2.JPG


3.JPG


It's all that.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  last year (edited)

Great work.

  • Keeping the CLIENT on a mutable global state (module scope) is considered bad. Here is a good discussion about it.

  • It seems you break general convention on model naming (class naming in general) with the Steemconnect_Model. My humble advise removing the model from the name just use SteemConnectUser.

  • I see you set a random password for steem connect users. django.auth package has a set_unusable_password helper for that kind of stuff.

  • Using get_or_create, here help removing a couple of extra lines.

  • Having descriptive commit messages has a part on our scoring logic. A commit message with just "rename" doesn't make any sense to the other developers reading the git history.


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

·

Thanks for your advice and preview 👍, I will update this project with a new commit. 🤚

·

Hey @emrebeyler
Here's a tip for your valuable feedback! @Utopian-io loves and incentivises informative comments.

Contributing on Utopian
Learn how to contribute on our website.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Thanks friend information about it

Hey @hakancelik
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!