Sending a request to retrieve the data from Django - html

I am doing a Web project, where I am using HTML5 and Django to store database in sqlite3. The part being, since I had to use python, I installed mod_python for apache2. Now the thing is I went through many sites for head start to store the data and retrieve it. When I check in google related to how to use mod_python I did get certain information on how I can send a request to a .py file and then execute it. But with Django documentation providing a tutorial which is to develop a polling webApp, I am not finding it measurable to the part I am trying to achieve.
I want to send the request from an Html file where I have a search box and some radio buttons, to Django through Apache2 (mod_python) and then access my database in sqlite3. Please could anyone give me brief idea on whether I am doing it right? Also if yes, can u give me a hint as in how can I send the request from HTML file to the database from Django and mod_python being used? I am a bit confused with Django tutorial.
Please if anyone can just let me know what exactly I should do! Or if any link with a proper guidance would be of great help.
Thank you.

Well, for starters, if you can install and use mod_wsgi instead of mod_python, you should -- mod_python hasn't been supported for years. I'd also strongly recommend that you use anything other than SQLite for a production web application -- SQLite doesn't cope well with multiple simultaneous transactions.
If you're stuck using mod_python, then see the Django documentation for using mod_python.
Once you've got that working, the rest of your questions can be answered by the Django Tutorial, particularly part 4, which covers the use of HTML forms with Django views and templates:
http://docs.djangoproject.com/en/1.3/intro/tutorial01/
http://docs.djangoproject.com/en/1.3/intro/tutorial02/
http://docs.djangoproject.com/en/1.3/intro/tutorial03/
http://docs.djangoproject.com/en/1.3/intro/tutorial04/

Related

How do I link a react app I am building using webpack to a phpmyadmin external database and query it without showing my database password in the code?

So I am currently learning react and webpack so that I can implement it into my current site. I already have an established phpmyadmin database that pumps out information that I want to appear on my site but I cant figure out how to hide my username and password to the database when programming it. I am used to using php to interact with my database bus since react is purely javascript I am not sure what to do.
You need to have a server running that talks to your database and to your react app. It sounds like you might have this in the form of a PHP application. Your PHP application will need to expose data over HTTP endpoints that you can then fetch from inside of your React application.
This tutorial: https://www.techiediaries.com/php-react-rest-api-crud-tutorial/ would be a great place for you to get started.
I agree that you need to "have a server running that talks to your database and to your react app" as the accepted answer states. On the other hand this does not mean that you have to code it from scratch.
If you don't want to program PHP for the back-end, then you may as well configure software from the list of 'automatic APIs'. An automatic API is "software that turns your database into a REST/GraphQL API".
I'm the author of PHP-CRUD-API, which is an 'automatic API' and I think it suits your needs, but you may as well use any other software from the above list.

Reading from a databse in AngularJS

My question is a simple enough one but I can't quite seem to find a good tutorial on it. Maybe I am not being specific enough with what I am asking but I can't really type an explanation into google and expect an answer.
So here is my question;
I currently have a website up and running on a hosting site and this hosting site allows me to have a database up on their server as well.
So my question is how do I read data from this database that I have setup using phpAdmin? Also, it is a mySQL database.
The website will be acting like a review site built I just want to use it to learn web development as well. So What I am trying to do it read articles that I will be saving in the database so I can display them on my website.
Any help or advice in regard to this is much appreciated.
Thanks in advance,
Cylon.
you cant read directly from a Database using AngularJS or any Client-side framework , you need a back-end / server-side language such as PHP ,C# ,Java..
to connect to your MySql ,MSSql... ,
so in your case your need to create PHP script which will connect to the Database and provide an interface you can access with (GET , POST methods ) using AngularJS ($http.post("url"...)
for a best practice (if you want) the Data should be in JSON format.

How do you incorporate Node.js/passport into my website?

I'm new to webdev and I'm trying to use passport for registration/authentication on a site I'm setting up. I'm also going to write an application in node later on that will be using some of the user data (users will need to provide an API key for an account on another site that I will use to pull data into the application).
At the moment, the main issue I'm having is figuring out what goes where. I've found plenty of resources that explain how to create an app using passport, but nothing shows how it would be incorporated into your website or where the files should be in relation to your website. I'm relatively new to Node.js, and while I've written a few small applications I have never hosted them anywhere.
Bonus question: I'm using MongoDB with passport and I was also planning to use it to store some JSON my application will be receiving from API calls. However, I wanted to use MySQL to store some data as well. More specifically, I'm planning to save the raw JSON then I'll create a relational database out of the data I need from the JSON and then keep the rest in MongoDB for easy access. Is this common/smart, or should I focus on keeping everything in my MongoDB? I'm relatively new to NoSQL.
Thanks in advance for any help.
I would reference this tutorial. I just recently used this to help myself with a new application. Also there is an example of the same thing but in SQL here. So not sure what you mean by " where the files should be in relation to your website". The information related to to authentication should go in your database.
To your "bonus question" you can use two databases. The key here is to ask yourself why and what are the true needs for data, and how is this data accessed and used. From ground up I would like one and stick with it. If at some point later you realize a certain type of data would be better in a different database then you can add it.
Side note: look into an IDE such as webstorm to help you out.

Is it possible to write mysql queries in Angular.JS?

Im new to Angular.JS and just wondering if it is possible to write mysql queries in angularjs?
I would like this as I am trying to create a messaging system in which I query the database and get the information live to the webpage.
Any help is appreciated, hope the question is reasonable. Gab
That is not advisable (if possible at all) as it would defeat the purpose of Angular.
You should consume data by targeting a RESTful api/service exposed by the server. The service would handle the DB access for you and provide the data to Angular using a more portable format (e.g. JSON or XML)
Some of the basics of linking Angular and REST are described here
There are related questions on SO about exposing your particular DB flavor using REST here.
This can only be a starting point but it should give you some ideas. I will try to amend this with more info as I come across it.

iOS and SQL xml report

I know that there's a lot of posts about that, but i can't find any one that suit my needs.
Here we go: I am developing (newbie dev, of course) an iOS app that is suppose to populate an UITableView with the acquired data from a xml report from a server (mysql and php).
The point is I was able to manually generate the sql report on the server (actually is a wordpress plugin that manually generate and save the report inside a folder on the server) and made the app download it by pointing to the right location of the file (very basic i Know) but is there an easy way of making my app send a request to the server to automatically generate and download the xml?
All the data i must use is inside a database on the server. The parse of the xml is not that difficult and I can handle it. My real problem is allowing the app sending those requests to the server.
Please note that i have no experience in PHP or SQL and have poor knowledgement on that tools so that is what i haven't found any post that suits me as all of them talks in a advanced SQL and PHP language.
All help is appreciated.
Thanks in advance folks!
You'll want to make an NSUrlRequest against a php script on your web server that runs the query and returns the XML as the output. See this link from the Apple guide to get you started: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html
The question is too general to give more specific advice than that you should take a look at the Cocoa URL loading system, or alternatively another networking library such AFNetworking.