Django and Django rest framework - django

I was following a resource https://blog.learncodeonline.in/how-to-integrate-razorpay-payment-gateway-with-django-rest-framework-and-reactjs
Instead of using reactjs for the front end. How can i make the frontend using Django templates? Please help. Thank you.

It will be same as any normal Django Project. Instead of exposing APIs you can use normal Django Templating for your response.
Had made a similar project which might help you to understand the concepts.
To run:
pip3 install -r requirements.txt
python3 manage.py runserver
Access the frontend template page on localhost:8000/customer/template/
Access the GET & POST APIs at localhost:8000/customer/
Link to the project: Simple CRM Project
If you need any help with it you can raise an issue at Github. Hope, it helps.

Related

How can I detect third party package translations

I’ve made a Django third party app, which I’m using in a Django project, running in Docker Compose. I want to translate ValidationError messages from the app inside the project, but the makemessages command doesn’t detect them. I thought, I’ll just add them manually, but when I call makemessages after that, my manually added translations are commented out.
I’ve looked for solutions, and found those SO-posts
Django translations of third party apps
Django's I18N with third-party apps
The posts explain that I should be using symlinks, but I have had no success of doing it (same results as above), see an example below:
docker-compose exec web ln -s /usr/local/lib/python3.8/site-packages/mypackage ./
docker-compose exec web python manage.py makemessages --locale=da --symlinks
So I’m looking for help, what am I doing wrong or could I do something else? Maybe translate the messages inside the third party app itself like Django Rest Framework does?
I hope you can help, very much looking forward for anything that can point me in the right direction.

Saleor comes with react by default. Can we have a 'basic' Saleor without frontend frameworks?

I wanted to use Saleor for a "single-type-product" e-commerce website. I installed Saleor yesterday but it has a huge requirements file, including react.js and many other frontend stuff. I don't want them. Is it possible to install Saleor without anything else? Or at least, with the least other requirements?
Yes, you can simply install the backend and expose the graphql api endpoint to consume data from you front-end. Or go regular django-style and use templated views. Simply clone the repo here https://github.com/mirumee/saleor.git, install, migrate and run the django server.
Yes. You can install saleor only the backend part.
To do so,
run git clone https://github.com/mirumee/saleor.git
after that,
create a docker-compose.yml file if you would like to run with docker-compose
otherwise you are good to go.

Using wwwhisper for a Django app in Heroku

it is possible to use wwwhisper add-on for a Django app? In that case, where can I find any guide about how to configure it? I've already installed the add-on, but I don't know how to make it work.
Thanks.
wwwhisper author here. The add-on works only with Ruby and Node.js applications on Heroku.

How can I get started developing with Django on Cloud9?

So Cloud9 looks really cool, and you can create python files in it, but I can't figure out how to get it to run a Django project. I imported one from my github account into the IDE, but it says I need to install Django (a django.core import error) so I need to help getting going. Any Ideas? Any skeleton projects on the web that I missed that will do this?
After some research and looking for an answer on different blogs and sites I finally found a solution:
Create a new workspace
Execute easy_install django to install Django
Create new Django project python ./../bin/django-admin.py startproject myproject
Start dev server python ./myproject/manage.py runserver $IP:$PORT
Access http://projectname.username.c9.io
Voilà!!!
I hope this helps
Just write commands in shell as it is:
sudo pip install -r requirements.txt (you should have there django)
than
python manage.py runserver $IP:$PORT
you will have app on https://projectname-username.c9.io
You may also have to add the proper path: <workspace_name>-<username>.c9users.io to the ALLOWED_HOSTS list in django_project/settings.py file, as suggested by the error message returned by django server. Tested on Django 2.0

How do I install an open source django-application?

I want to install an existing django app, djangopeople.net. The code is at http://github.com/simonw/djangopeople.net.
I installed django and I understand how to create a new django project.
But how do you deploy an existing app? I know how this works in Rails or Symfony, but I don't really get the django concept here.
Where do I put the files? Which scripts do I run?
Thanks for the steps.
Why is this any different from deploying your own applications? Just put them somewhere in your PYTHONPATH and set up mod_wsgi or whatever to serve them.