Getting started Play Framework

1.What is Play?

The High Velocity Web Framework For Java and Scala.

Play Framework makes it easy to build web applications with Java & Scala.

Play 框架使用Java和Scale的Web Applications 变得非常容易构建。

Play is based on a lightweight, stateless, web-friendly architecture.
Play是一个基于轻量级的、无状态的、面向Web的框架。
……
play的详细介绍大家直接去 官网看文档。
我的理解是,play framework是一个基于scala的轻量级web开发框架。Play framework本身是采用scala编写的,在设计过程中深受Ruby on Rails的启发与影响。在Play framework基础上,开发人员可以自由选择使用Java还是Scala进行web开发,并可与已有的Java程序方便地集成。在如今xml(annotation)横飞的Java EE开发领域,Play framework可以说是Java开发人员的福音。在约定优于配置的指导思想下,终于可以和繁琐的配置文件说再见了!

2.How to install?

2.1Play requires Java 1.8. To check that you have the latest JDK, please run:

java -version

2.2下载安装包和配置环境变量
下载地址:https://www.playframework.com/download

点击下载(只有1M),然后解压(G:\play\activator);
编辑系统的path环境变量(G:\play\activator\bin)
安装完毕。
2.3测试安装是否成功
打开cmd,
activator help

如果弹出了帮助信息,就说明安装成功了!So easy!

2.4 Helloworld!

按照国际惯例,编写第一个Helloworld程序。

cmd切换到项目的目录(G:\play\project),

2.4.1先建一个play-java项目(Helloworld


activator new
初次使用,可以需要等待若干分钟,因为它在下载相关资源和模板,之后就很快了。

2.4.2 选择模板

输入5,选择play-java模板,输入helloworld为项目名称,这样一个java项目就自动生成了。



2.4.3打开Helloworld项目目录

cd helloworld


2.4.4启动服务器


activator run

打开浏览器,http://localhost:9000/



看到上面的这个网页就表示helloworld已经妥妥了!

但是你还没写“helloworld”是吗?修改一下G:\play\project\Helloworld\app\controllers\HomeController.java


刷新页面


修改成功,前所未有的简单。

Helloworld到此剧终!



Run pip install --upgrade pip Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (25.2) Collecting speechrecognition>=3.10.0 (from -r requirements.txt (line 1)) Downloading speechrecognition-3.14.3-py3-none-any.whl.metadata (30 kB) Collecting pyttsx3>=2.90 (from -r requirements.txt (line 2)) Downloading pyttsx3-2.99-py3-none-any.whl.metadata (6.2 kB) Collecting pyaudio>=0.2.14 (from -r requirements.txt (line 3)) Downloading PyAudio-0.2.14.tar.gz (47 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting python-dotenv (from -r requirements.txt (line 4)) Downloading python_dotenv-1.1.1-py3-none-any.whl.metadata (24 kB) Collecting psutil (from -r requirements.txt (line 5)) Downloading psutil-7.1.1-cp36-abi3-macosx_11_0_arm64.whl.metadata (23 kB) Collecting playsound (from -r requirements.txt (line 6)) Downloading playsound-1.3.0.tar.gz (7.7 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [28 lines of output] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/pip-build-env-73fj8g_y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/pip-build-env-73fj8g_y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires self.run_setup() File "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/pip-build-env-73fj8g_y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/pip-build-env-73fj8g_y/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 6, in <module> File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 1258, in getsource lines, lnum = getsourcelines(object) ^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 1240, in getsourcelines lines, lnum = findsource(object) ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 1077, in findsource Error: raise OSError('could not get source code') OSError: could not get source code [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. Error: Process completed with exit code 1.
最新发布
10-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值