Level 1
web application代写 For this level you must write a simple web application that generates two pages. You are given a set of requirements below
For this level you must write a simple web application that generates two pages. You are given a set of requirements below, these are encoded in a set of tests ( level1_functional.py in the starter kit) that your application must pass. The tests correspond to the functional requirements below.
Functional requirements web application代写
- Welcome to Jobs
As a visitor to the site, when I load the home page I see the title text “Welcome to Jobs”.
- About Page Link
As a visitor to the site, when I load the home page I see a link to another page with the link text “About”.web application代写
- About Page
As a visitor to the site, when I click on the link “About” I am taken to a page that contains the site manifesto, including the words “Jobs is a new, exciting, job posting service like nothing you’ve seen before!”.
- Consistent Design
As a visitor to the site, I notice that all the pages on the site have the same design with the same colours and fonts used throughout.
Each page will have a similar structure and will link to a common CSS stylesheet.
Unit Tests
There are no unit tests for this level.
Your Task web application代写
To achieve these requirements you will need to build a bottle web application that is able to serve the two HTML pages (Home and About) and the associated stylesheet. The techniques to do this are covered here:
- Python Web Applications.
- Generating HTML Pageslooks at the Bottle page templating system.
- Testing Python Programscovers running unit tests.
Getting Started
You should be able to unpack the starter kit and run main.py to see a very simple single page web application that is the starting point for your work. You need to extend this to meet the requirements above. This application is very similar to others that you will have written in tutorials and so should not present any new problems for you to solve; you just need to apply the techniques you’ve already learned.
The functional requirements have been laid out in a suggested ordering. Start by writing code to meet the first requirement before moving on to the second. Treat each requirement as a sub-problem. Understand what is asked of you and design a solution, then implement it. These requirements may seem too trivial to work like this but as they get more complicated you will benefit from this approach.
Run the functional tests before and after you implement each requirement. You should see the test fail before, and when you see it pass you know you have a correct solution. This is known as Test Driven Development – normally you would write the tests yourself to encode your understanding of the users requirements.
Level 2 web application代写
In this phase you will write a basic version of the web application that can display but not create job listings. This means we don’t yet have to worry about login and sessions but that you must interface to the database to lists positions.
Following the model-view-controller architecture, the first thing that you’ll implement is the database model. This is contained in a module interface.py with all of the code to retrieve and store positions in the database. You will then implement the views (templates) and controllers for the web application that makes use of the models present the data on the web.
All of the work you do will be tested using unit tests. For the database interface, there are straightforward unit tests of the functions that you will write. To test the behaviour of the web application we’ll use functional testing that requests your pages and checks that they have certain contents, and that we can login and position messages. We will do this using a module called WebTest that is designed specifically for functional testing of Python web applications.
Unit Tests
All procedures will be implemented in the module interface.py. A version has been supplied that contains the procedure stubs only.
When we refer to a database connection below we mean the connection returned by the sqlite3.connect function. In all cases this will be passed into your functions. The connection is created either by your main application or the test code.
- position_list
There is a function position_list(db, limit=10). db is a database connection and the optional argument limit is an integer. The function returns a list of tuples representing the positions stored in the database, each tuple contains: (id, timestamp, owner, title, location, company, description). Messages are returned in reverse order of the timestamp, most recent first.
- position_get
There is a function position_get(db, id). db is a database connection and id is an integer position identifier. The function returns a tuple representing the position with the given id, the tuple contains: (id, timestamp, owner, title, location, company, description). web application代写
If the id does not match a record in the database, the function should return None.
- position_add
There is a function position_add(db, usernick, title, location, company, description). db is a database connection, the argument usernick is a user name and title, location, company and description are the values of the respective fields in the positions table. The function adds the new position to the database.
If usernick does not a user in the users table, no new record should be created and the function should return False
If the record is added successfully, the function should return True.
Functional requirements web application代写
The functional requirements describe what a user should be able to see and do on the web application. They describe what happens when you load a particular URL or submit a form in a page. There are automated tests to check that you have implemented this functionality correctly.
- Home Page List of positions
As a visitor to the site, when I load the home page (URL /) I see a list of up to 10 positions in order of their timestamps, most recent first. Each position must include the position timestamp, title, owner and the first 100 characters of the text of the position description. At the end of each listing should be a link to view the entire position with the text “Read More” and the url /positions/DD where DD is the position id.
The list of positions that appears should be the result of a call to position_list which will extract the most recent 10 positions from the database.
- Position Page
As a visitor to the site, I can click on the “Read More” link after a position description on the home page, I see a page with the full description of the position at the URL /positions/DD where DD is the position id.
The position page should contain all of the database fields for the position, laid out in a readable way. It should also contain a link to return to the main page.
Your Task
To achieve these requirements you need to write code in interface.py to implement the different functions to interface to the database. Run the unit tests in level2_unit.py to check whether you have met the requirements.web application代写
Once you have a working version of interface.py you can move on to write the application itself in main.py. Take each required page in turn and write the code to generate the content using the functions you have written. You can check the functional requirements yourself and run the unit tests in level2_functional.py to validate that you’ve met the requirements.
- Python Web Applications.
- Python and SQLitedescribes the way to send queries to SQLite and get results back.
- Generating HTML Pageslooks at the Bottle page templating system.
- Testing Python Programscovers running unit tests.
更多其他:prensentation代写 文学论文代写 商科论文代写 网课代修 代写CS 数据分析代写 润色修改 代写案例 Assignment代写
您必须登录才能发表评论。