Migrating From Django to Pyramid [closed] - python

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have created an online webstore. Initially I used Django due to its awesome ORM (in fact the first ORM I met) and built-in admin.
My webstore consists of couple basic components such as shopping cart, a catalog and some user management module.
Over the time I realized that using the built-in admin is not efficient. I spent a lot of time reworking the data registration form due to FK relationship tables and as the items in the webstore diversified, the catalog table has to be extended.
One of the solution that came across my mind is to develop the catalog using NoSQL such as MongoDB in order to make it more flexible. A great idea but then I found out that NoSQL is not officially supported in Django. There is a fork of Django that supports NoSQL but the version is way behind the mainstream and there is no guarantee will be supported for a long time.
Then I came across Pyramid. I really love Python and I would like to stay developing using it. I found out that Pyramid has SQLAlchemy to replace the Django ORM and can be used with MongoDB. It also simpler; I have to plug only components that I want to use and there is lesser point of sticking with Django as I found out the built in admin is not practical for this.
However, I have yet found any good Pyramid hosting. Should I migrate my webstore to Pyramid? Does it worth it? What are the risk and challenges that I need to consider before this migration?

The MongoEngine is very similar to the ORM used by Django.
Sample code:
Model:
class UserProfile(Document):
user = ReferenceField(User, required=True, primary_key=True)
name = StringField()
View or Action
user_obj = authenticate(username=account, password=passwd)
profile_obj = UserProfile.objects(user = user_obj).first()
profile_obj.name = "Mongo"
profile_obj.save()

Related

Is SQL or NoSQL a better choice for a beginner Django project? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
When it comes to actually deploying a Django project, is SQL software, like PostegreSQL, or NoSQL, like MongoDB, a better option?
To evaluate which might be a better choice, you can consider:
requires less changes to the actual code of the already existing project - for example having to re-do the models structure,
has correct integration with the backend, i.e.: some years ago MongoDB wouldn't integrate with the Django backend,
is more beginner friendly.
Edit
For this example's sake, let's set some information:
the project uses models such as client, booking, flight, hotel.
it uses with ForeignKeys.
it connects a model client with django's own User model.
Data needs to be retrieved both to client side and administration side.
JSON might be used, if necessary, at some point in the future.
A SQL DB would be appropriate for this project. This is due to the use of foreign keys, the nature of the models and the relationship between client and user.
You will want to be able to store structured data and be able to maintain relationships between that data, this can be achieved with SQL.

How to get django admin app working with mongodb? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to use mongodb together with django. I mainly use the admin app of django.
I noticed that there are 2 mongodb orms for django.
One is mongoengine, https://github.com/MongoEngine/mongoengine
Another is mongodb-engine from the django-nonrel group.
https://github.com/django-nonrel/mongodb-engine
What I want to know is that whether django's admin app works fine with the two. If not,
which one is better.
Also, I want to know whether 3rd party apps would work if I use mongodb with django? Which of the two orms is more friendly with 3rd party apps?
At first glance, mongodb-engine seems to be more friendly, but it depends on django-nonrel,
which is based on django 1.5. If I want to use recent version of django, mongoengine seems to be the better choice, also mongoengine development seems more active.
The short answer is yes. Django works well with MongoDB.
Please check this thread for more relevant answers: On Using Django with MongoDB
Hope it helps.

What would be the more practical uses for a Django application w/out a database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I recently got into Django out of curiosity after developing for quite a while w/ Ruby on Rails and Node.js, and found that it's splendid for working w/ databases. Django is primarily known for working with databases and every tutorial I've ever found on it has included databases. Django supports not requiring databases however, and, just out of curiosity since I'm still rather inexperienced w/ Django, what would be some practical uses w/ Django w/out requiring databases?
I do not recommend using Django if you are not interested in using a database. Having written that disclaimer, if you insist on still using it, you can just scan over the documentation and identify what is still available to you if you do not have a database:
You can use Django's security features to help protect against clickjacking, cross site request forgeries, etc.
You can take advantage of Django's support for internationalization if you want to support multiple languages on your website.
You can have Django handle validation of any forms you have on your website.
...basically you can create a static website that takes advantage of the rapid prototyping enabled by a framework built using Python.
I can't think of many if I'm honest. If you are writing a web application that doesn't need to store to retrieve things from some sort of storage then using a whole Django project is probably total overkill.
A blog wouldn't really require a database if you only had a single user who was willing to add posts by adding files manually, but something like Jekell would be better for that.
You could create a web app that would interact with the server it's on. For example, you could create a web page that called a unix command when you hit a create webpage. You would be able to use to this create some sort of dashboard for your server or maybe provide a cleaner user interface for things that you could do with ssh. However, Django might be overkill for this, something like Flask might work better as you would have a lot less overhead.

What is the best way to implement Django Users? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm pretty new to django and I'm a little confused as to what is the best and common practice for implementing users in Django apps. Do people
use the django's built-in user system in each app,
create an app using django's built-in users and applying that to other apps,
use a third-party app like Pinax, or something else entirely?
Thanks for the help.
Unfortunately, "BEST" is very subjective. Django provides many flexible ways for you to model users (and customize users) so that you can leverage their built in authentication and user system.
Will django's built in user system provide you with everything you need for your requirments? If so then use it, If you just need to add a couple more fields, create a new model and give it a onetoone with the built in user object
Not so much, django provides a new AbstractBaseUser that should be flexible enough to do whatever you need to do regarding users, I have not used it personally yet, but documentation on it can be found https://docs.djangoproject.com/en/dev/topics/auth/customizing/
Does a third party app provide you with your desired functionality out of the box, or with minimal configuration? Probably
Basically, it all depends on your requirements! Django's built in user should be more then sufficient for the majority of websites

For what purpose Django is used for? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I heard a lot of people talking about Django on various forums. But I am having a very basic question : What is meant by Framework and why Django is used.
After listening a lot about Django, I ran few chapters for Django (from Djangobook.com). After running these chapters, I am wondering how Django can be used to create a very simple website. (Website should have few pages like Home, Favorites, About, Contact linked to each other and will be providing static content).
Can Django be used for creation of such website? I searched a lot on internet but couldn't find any relevant examples, I only encountered with the examples for creation of blog, forum sites etc. If Django can be used for creation of this website, what should be the approach.
Can someone please explain this basic term "Framework" and its significance?
No. It's not for making websites. Your sample just sounds like you want plain old HTML.
Django is for creating web applications. That is, software, normally backed by a database, that includes some kind of interactivity, that operates through a browser. A Framework provides a structure and common methods for making this kind of software.
I think what you're looking for is a very simple CMS (Content Management System), there are many of those available in all kinds of languages/frameworks. Django has django-cms and mezzanine (among others).
What django is really awesome at is building dynamic websites really fast, you don't need to worry about most things, you just define your data model and off you go (almost). If you want to have a better insight into what's possible, have a look at the django tutorial (under "First Steps"), it gives you a good introduction to django and how to build websites using it.
Django can be used to create dynamic high-security web applications. For creating a static website like the one you asked, HTML is enough.
Tutorial for creating a django application can be found here.

Categories

Resources